Changes between Version 50 and Version 51 of GenshiTutorial
- Timestamp:
- Aug 31, 2007, 1:07:22 AM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GenshiTutorial
v50 v51 7 7 In this tutorial we'll create a simple Python web application based on [http://cherrpy.org/ CherryPy 3]. !CherryPy was chosen because it provides a convenient level of abstraction over raw CGI or [http://wsgi.org/wsgi WSGI] development, but is less ambitious than full-stack web frameworks such as [http://pylonshq.com/ Pylons] or [http://www.djangoproject.com/ Django], which tend to come with a preferred templating language, and often show significant bias towards that language. 8 8 9 The application is a stripped-down version of sites such as [http://reddit.com/ reddit] or [http://digg.com/ digg]: it lets users submit links to online articles they find interesting, and then lets other users vote on those stories and post comments. Just for kicks, we'll call that application '''Geddit'''10 11 The project is kept as simple as possible, while still showing many of Genshi features and how to best use them:9 The application is a stripped-down version of sites such as [http://reddit.com/ reddit] or [http://digg.com/ digg]: it lets users submit links to online articles they find interesting, and then lets other users comment on those stories. Just for kicks, we'll call that application '''Geddit''' 10 11 We'll keep the project as simple as possible, while still showing many of Genshi features and how to best use them: 12 12 * For persistence, we'll use native Python object serialization (via the `pickle` module), instead of an SQL database and an ORM. 13 13 * There's no authentication of any kind. Anyone can submit links, anyone can comment. … … 32 32 33 33 1. Create a directory that should contain the application 34 1. Inside that directory create a Python package named geddit by doing the following:34 2. Inside that directory create a Python package named geddit by doing the following: 35 35 * Create a `geddit` directory 36 36 * Create an empty file called `__init__.py` inside the `geddit` directory 37 1. Inside that package, create a file called `controller.py` with the following content:37 3. Inside the `geddit` package directory, create a file called `controller.py` with the following content: 38 38 39 39 {{{ … … 57 57 58 58 def main(filename): 59 data = {} # We'll replace this later 60 59 61 # Some global configuration; note that this could be moved into a 60 62 # configuration file