Using templatesΒΆ

Pyrocumulus has an simple request handler that uses tornado’s template system with a little improvement on how to look for templates.

To use that, simply subclass pyrocumulus.web.handlers.TemplateHandler.

from pyrocumulus.web.handlers import TemplateHandler

class MyHandler(TemplateHandler):
    def get(self):
        template = 'myfile.html'
        extra_context = {'some': 'thing'}
        self.render_template(template, extra_context)

pyrocumulus.web.handlers.TemplateHandler makes use of the tornado template system, so you can use all features of that in your templates [1]. It takes root dir from the TEMPLATE_DIRS settings variable.

[1]Look the tornado.template docs here