jinja2 Engine for tornado web framework
Project description
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
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][1] from jinja2 and configuring jinaja2 [environment][2] by your self.
import tornado.web
jinja2loader = Jinja2Loader('templates_path')
settings = dict(template_loader=jinja2loader)
application = tornado.web.Application(handler=[],
**settings)
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)
[1]: http://jinja.pocoo.org/docs/dev/api/#loaders [2]: http://jinja.pocoo.org/docs/dev/api/#jinja2.Environment
Project details
Release history Release notifications | RSS feed
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.1.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for tornado_jinja2-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb4095f2e37126e889fefd252ccf171d45fc1f0385be403137b7f1ea88f2a05a |
|
MD5 | 82c95d74ad81a5f390ccf7c5a13130a8 |
|
BLAKE2b-256 | c91ea69ba31fc2ca9f4bd7686864ce37695ccdd3a75b4b70b42c94b6f2e64234 |