Changes between Version 25 and Version 26 of GenshiTutorial
- Timestamp:
- Aug 30, 2007, 1:09:24 AM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GenshiTutorial
v25 v26 165 165 }}} 166 166 167 This asks the template loader for a template named `index.html`, generates the output stream, and finally serializes the output to HTML. You you now reload the page in your browser, you should get back the following HTML:167 This asks the template loader for a template named `index.html`, generates the output stream, and finally serializes the output to HTML. When you now reload the page in your browser, you should get back the following HTML response: 168 168 169 169 {{{ … … 191 191 == Data Model == 192 192 193 To continue, we'll need to first add some classes to define the data model the application will use. As mentioned above, we're using a simple pickle file for persistence, so all we need to do here is create a couple of very simply Python classes.193 To continue, we'll need to first add some Python classes to define the data model the application will use. As mentioned above, we're using a simple pickle file for persistence, so all we need to do here is create a couple of very simply Python classes. 194 194 195 195 Inside the `geddit` directory, create a file named `model.py`, with the following content: … … 236 236 }}} 237 237 238 Andimport those classes in `geddit/controllers.py`, just below the other imports:238 You'll need to import those classes in `geddit/controllers.py`, just below the other imports: 239 239 240 240 {{{ … … 243 243 }}} 244 244 245 Now let's add some initial content to the “database”. You'll need to stop the CherryPy server to do that. Then, in the terminal, from the tutorial directory, launch the interactive Python shell, and execute the following code: 245 Now let's add some initial content to the “database”. 246 247 '''Note: You'll need to stop the !CherryPy server to do that, otherwise the data is overwritten'''. 248 249 In the terminal, from the tutorial directory, launch the interactive Python shell by executing `PYTHONPATH=. python`, and enter the following code: 246 250 247 251 {{{