overview ~
documentation ~
community
Welcome
Jinja2 is a full featured template engine for Python. It has full
unicode support, an optional integrated sandboxed execution
environment, widely used and BSD licensed.
Jinja is Beautiful
{% extends "layout.html" %}
{% block body %}
<ul>
{% for user in users %}
<li><a href="{{ user.url }}">{{ user.username }}</a></li>
{% endfor %}
</ul>
{% endblock %}
And Powerful
Jinja2 is one of the most used template engines for Python. It is
inspired by Django's templating system but extends it with an expressive
language that gives template authors a more powerful set of tools. On top
of that it adds sandboxed execution and optional automatic escaping for
applications where security is important.
It is internally based on Unicode and runs on a wide range of Python
versions from 2.4 to current versions including Python 3.
Wide Range of Features
- Sandboxed execution mode. Every aspect of the template execution is
monitored and explicitly whitelisted or blacklisted, whatever is
preferred. This makes it possible to execute untrusted templates.
- powerful automatic HTML escaping system for cross site scripting
prevention.
- Template inheritance makes it possible to use the same or a similar
layout for all templates.
- High performance with just in time compilation to Python bytecode.
Jinja2 will translate your template sources on first load into Python
bytecode for best runtime performance.
- Optional ahead-of-time compilation
- Easy to debug with a debug system that integrates template compile and
runtime errors into the standard Python traceback system.
- Configurable syntax. For instance you can reconfigure Jinja2 to
better fit output formats such as LaTeX or JavaScript.
- Template designer helpers. Jinja2 ships with a wide range of useful
little helpers that help solving common tasks in templates such as
breaking up sequences of items into multiple columns and more.
Contribute
Found a bug? Have a good idea for improving Jinja2? Head over to
Jinja's new github page and
create a new ticket or fork. If you just want to chat with fellow
developers, visit the IRC channel or join the
mailinglist.