layout | title |
---|---|
default |
Templating with Genshi |
Put your "code.py" in root directory.
# -*- coding: utf-8 -*-
import web from web.contrib import template
render = template.render_genshi(['./templates/'])
urls = ( '/', 'index' )
class index: def GET(self): name = 'John Doe' return render.index(name=name)
app = web.application(urls, globals()) if name == "main": app.run()
Put your "index.html" in "template" directory.
<?xml version="1.0" encoding="utf-8"?>
<html xmlns:py="http://genshi.edgewall.org/">
<body>
<p>Hello, $name.</p>
</body>
</html>