Go to file
2025-05-28 11:44:50 -07:00
.devcontainer use uv for dependency management 2025-05-28 10:08:29 -07:00
.github drop end of life python versions 2025-05-28 11:13:57 -07:00
artwork documentation style updates, added print css 2008-05-06 12:14:23 +02:00
docs drop end of life python versions 2025-05-28 11:13:57 -07:00
examples/basic fix Jinja syntax in example 2024-12-18 09:44:30 -08:00
scripts Merge branch '3.1.x' 2023-06-01 10:50:38 -07:00
src/jinja2 fix typo 2025-05-28 11:44:50 -07:00
tests fix type/lint/format findings 2025-05-28 10:08:39 -07:00
.editorconfig update project files (#5457) 2024-04-23 09:28:57 -07:00
.gitignore use uv for dependency management 2025-05-28 10:08:29 -07:00
.pre-commit-config.yaml use uv for dependency management 2025-05-28 10:08:29 -07:00
.readthedocs.yaml use uv for dependency management 2025-05-28 10:08:29 -07:00
CHANGES.rst deprecate __version__ 2025-05-28 11:39:42 -07:00
LICENSE.txt update project files (#5457) 2024-04-23 09:28:57 -07:00
pyproject.toml deprecate __version__ 2025-05-28 11:39:42 -07:00
README.md use global contributing guide 2025-01-14 13:43:41 -08:00
uv.lock deprecate __version__ 2025-05-28 11:39:42 -07:00

Jinja

Jinja is a fast, expressive, extensible templating engine. Special placeholders in the template allow writing code similar to Python syntax. Then the template is passed data to render the final document.

It includes:

  • Template inheritance and inclusion.
  • Define and import macros within templates.
  • HTML templates can use autoescaping to prevent XSS from untrusted user input.
  • A sandboxed environment can safely render untrusted templates.
  • AsyncIO support for generating templates and calling async functions.
  • I18N support with Babel.
  • Templates are compiled to optimized Python code just-in-time and cached, or can be compiled ahead-of-time.
  • Exceptions point to the correct line in templates to make debugging easier.
  • Extensible filters, tests, functions, and even syntax.

Jinja's philosophy is that while application logic belongs in Python if possible, it shouldn't make the template designer's job difficult by restricting functionality too much.

In A Nutshell

{% extends "base.html" %}
{% block title %}Members{% endblock %}
{% block content %}
  <ul>
  {% for user in users %}
    <li><a href="{{ user.url }}">{{ user.username }}</a></li>
  {% endfor %}
  </ul>
{% endblock %}

Donate

The Pallets organization develops and supports Jinja and other popular packages. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects, please donate today.

Contributing

See our detailed contributing documentation for many ways to contribute, including reporting issues, requesting features, asking or answering questions, and making PRs.