Skip to main content

jinja2 Engine for tornado web framework

Project description

Integrate Jinja2 into Tornado Framework
=======================================

This package makes you have the ability that using Jiaja2 Template Engine with Tornado Web Framework.
It will replace the default Tornado Templates.

How to use:
-----------

Import Jinja2Loader to your project

.. code-block:: python

from tornado_jinja2 import Jinja2Loader


Pass the instance of Jinja2Loader to `tornado.web.Application` as the value of "template_loader" parameter.
You can use the particular-Loader_ from jinja2 and configuring jinaja2 environment_ by your self.

.. code-block:: python

import tornado.web
import jinja2

# Create a instance of Jinja2Loader
jinja2_env = jinja2.Environment(loader=jinja2.FileSystemLoader('template/path/'), autoescape=False)
jinja2_loader = Jinja2Loader(jinja2_env)

# Give it to Tornado to replace the default Loader.
settings = dict(template_loader=jinja2_loader)
application = tornado.web.Application(handler=[],
**settings)




.. _Loader: http://jinja.pocoo.org/docs/dev/api/#loaders
.. _environment: http://jinja.pocoo.org/docs/dev/api/#jinja2.Environment


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tornado_jinja2-0.2.3.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

tornado_jinja2-0.2.3-py2.py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page