GO-V.ORG
As seen in

Jinja (template engine)

Jinja is a web template engine for the Python programming language.[src] It was created by Armin Ronacher and is licensed under a BSD License.[src] Jinja is similar to the Django template engine, but provides Python-like expressions while ensuring that the templates are evaluated in a sandbox.[src] It is a text-based template language and thus can be used to generate any markup as well as source code.[src] The Jinja template engine allows customization of tags, filters (for formatting or transforming values ), tests (for evaluating conditions ), and globals.[src] Also, unlike the Django template engine, Jinja allows the template designer to call functions with arguments on objects.[src] Jinja is the default template engine for Flask, as well as Home Assistant's Automations.[src] It is also used by Ansible, Trac, and Salt.[src] It is also used to make SQL macros, for example for use with dbt.[src]

Jinja is a web template engine for the Python programming language.[src] It was created by Armin Ronacher and is licensed under a BSD License.[src] Jinja is similar to the Django template engine, but provides Python-like expressions while ensuring that the templates are evaluated in a sandbox.[src] It is a text-based template language and thus can be used to generate any markup as well as source code.[src] The Jinja template engine allows customization of tags, filters (for formatting or transforming values ), tests (for evaluating conditions ), and globals.[src] Also, unlike the Django template engine, Jinja allows the template designer to call functions with arguments on objects.[src] Jinja is the default template engine for Flask, as well as Home Assistant's Automations.[src] It is also used by Ansible, Trac, and Salt.[src] It is also used to make SQL macros, for example for use with dbt.[src] ==Features== Some of the features of Jinja are: sandboxed execution automatic HTML escaping to prevent cross-site scripting (XSS) attacks template inheritance compiles down to the optimal Python code just-in-time optional ahead-of-time template compilation easy to debug (for example, line numbers of exceptions directly point to the correct line in the template) configurable syntax Jinja, like Smarty, also ships with an easy-to-use filter system similar to the Unix pipeline.[src] Statements which set variables in jinja or those which do not have an output can be wrapped within {% and %} , using the set keyword.[src] For example {% set foo = 42 %} sets a variable called foo with a value of 42.[src] Similar to above, comments in jinja can be written using a number sign ( # ) instead of a percentage ( % ), for example, {# helpful comment #} .[src] The syntax for creating a filter in Jinja is a vertical bar ( | ), for example .[src] A variable can have multiple filters, for example ).[src] The syntax for creating a test in Jinja is the keyword is as well as the conditions for evaluating the validity of a test, such as for example {% if variable is divisibleby 10 %}do something{% endif %} ).[src] For loops can be used to iterate over sequences, while retaining their object properties.[src] The following example demonstrates iterating over a list of users with and fields.[src] {% for user in users %} {% endfor %} Although and are not allowed inside loops, sequences can be filtered.[src] {%- for item in item_list %} {% if not loop.last %},{% endif %} {%- endfor %} and templating code: from jinja2 import Template with open("example.html.jinja") as f: tmpl = Template(f.read()) print(tmpl.render( variable = "Value with data", item_list = [1, 2, 3, 4, 5, 6] )) This produces the HTML string: Value with <unsafe> data 1, 2, 3, 4, 5, 6 Note the minus sign ( - ) after the tag {% : If you add a minus sign ( - ) to the start or end of a block (e.g.[src] a For tag), a comment, or a variable expression, the whitespaces before or after that block will be removed.[src]

30 sentences · 30 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Jinja (template engine)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/jinja-template-engine. Accessed 05 December 2026.

Chicago

"Jinja (template engine)." encyclopegia.org. Accessed December 5, 2026. https://encyclopegia.org/wiki/jinja-template-engine.

APA

encyclopegia.org. (2026). Jinja (template engine). Retrieved December 5, 2026, from https://encyclopegia.org/wiki/jinja-template-engine

Accessed December 5, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Template:New Wave (Contest)

stub · references available

Template:Support

stub · references available

Template:Lang-tr

stub · references available

Template:Footy-stub

stub · references available

Template:Location map Iceland

stub · references available

Template:Location map Sweden, 40south

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1351961763 · 0.5 · snapshot enwiki-001351961763

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools
  • Careers — open roles: frontier engineers and sales partners
  • Index — every corpus, paper and record
  • Estate guide — what a public data estate is
  • Founder — Lois-Kleinner Alpasan
  • Records — DOIs and external deposits
  • Documents — one-pagers, PDFs and QR codes
  • Brand kit — logos and share images
  • Papers — plain-language briefs with citations
  • Browser — search engine, PWA and bookmarklet
  • Anticloud — the operator and its projects

As seen in Business Insider · 336 outlets · evidence DOIs · plain-language papers

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.