view examples/cherrypy/index.py @ 309:f7a3bb316d2f

The template engine plugin now defaults to automatically reload modified templates, as it was before the introduction of plugin config options in [359].
author cmlenz
date Tue, 17 Oct 2006 14:06:30 +0000
parents aa16cebbcfe4
children 3879c9ad3472
line wrap: on
line source
import os
import sys

import cherrypy
from genshi.template import TemplateLoader

loader = TemplateLoader([os.path.dirname(os.path.abspath(__file__))])


class Example(object):

    @cherrypy.expose
    def index(self):
        tmpl = loader.load('index.html')
        return tmpl.generate(name='world').render('xhtml')


cherrypy.root = Example()

if __name__ == '__main__':
    cherrypy.config.update(file='config.txt')
    cherrypy.server.start()
Copyright (C) 2012-2017 Edgewall Software