Turbogears and Genshi baby steps
Wednesday, September 20, 2006
These are the baby steps for using Genshi template system in Turbogears.
1 - In case you have not installed Genshi do....
easy_install Genshi
2 - Create a new turbogears project with...
tg-admin quickstart genshibasic
3 - Go to controllers.py in ./genshibasic/genshibasic directory
add this to the Root class
@expose(template="genshi:genshibasic.templates.genshi")
def genshi(self):
return dict(pretty="basic")
4 - create a new template file ( genshi.html ) in the templates directory of the project.
include this in genshi.html ...
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
lang="en">
pretty ${pretty}
</html>
5 - Start your project with
python start-genshibasic.py
6 - Open your browser and type http://localhost:8080/genshi
Enjoy!
The rest is to study carefully genshi documentation to be a black belt.