What Is Jinja Templating Engine
Jinja, also normally referred to as "Jinja2" to specify the newest release version, is a Python template engine used to create HTML, XML or other markup formats that are returned to the user via an HTTP response.
Why is Jinja2 useful?
Jinja2 is useful considering it has consequent template tag syntax and the project is cleanly extracted as an independent open source projection so information technology can be used as a dependency past other code libraries.
Jinja2 strikes a thoughtful balance on the template engine spectrum where on one stop y'all can embed arbitrary code in the templates and the other end a developer tin code any she wants.
Jinja2 origin and development
The starting time recorded public released of Jinja2 was in 2008 with two.0rc1. Since then the engine has seen numerous updates and remains under agile development.
Jinja2 engine certainly wasn't the offset template engine. In fact, Jinja2'southward syntax is inspired past Django'south built-in template engine, which was released several years earlier. At that place were many template systems, such as JavaServer Pages (JSPs), that originated almost a decade before Jinja2. Jinja2 congenital upon the concepts of other template engines and today is widely used by the Python community.
What projects depend on Jinja2?
Jinja2 is a normally-used templating engine for spider web frameworks such equally Flask, Bottle, Morepath and, as of its 1.8 update, optionally Django equally well. Jinja2 is also used as a template linguistic communication by configuration direction tool Ansible and the static site generator Pelican, amongst many other similar tools.
The idea is that if a developer already knows Jinja2 from working with one project and then the exact same syntax and style can be used in another project that requires templating. The re-apply reduces the learning curve and saves the open source projection author from having to reinvent a new templating style.
Jinja2 resources
-
Existent Python has a nice Jinja2 primer with many code examples to testify how to use the template engine.
-
The second part of the Flask mega tutorial is all most Jinja2 templates. Information technology walks through control flow, template inheritance and other standard features of the engine.
-
Upgrading to Jinja2 Templates in Django 1.8 With Admin shows how to fix an issue that tin can occur with Django i.8 and using Jinja2 every bit the template engine.
-
The official Jinja2 templates documentation is uncommonly useful both as a reference equally well as a full read-through to sympathise how to properly piece of work with template tags.
-
When y'all desire to use Jinja2 outside of a web framework or other existing tool, here's a handy quick load function snippet and then the template engine can be hands used from a script or the REPL.
-
When working with Jinja2 in combination with LaTeX, some of Jinja2's blocks can conflict with LaTeX commands. Check out this post on LaTeX templates with Python and Jinja2 to generate PDFs to resolve those problems.
-
When yous use Jinja2 for long enough, somewhen yous'll want to escape large blocks of Jinja2-like text in your templates. To do so, you'll demand the "raw" template tag.
-
Python Templating Performance Showdown: Django vs Jinja puts together some benchmarks for how Django templates compare with Jinja templates. The usual benchmarking caveats apply hither simply there are some interesting tests that examine how the template engines handle large numbers of variables and other factors.
-
Universal Jinja presents a high-level overview of what you could do using the Jinja-like Nunchuks library to perform server-side template rendering for Django applications.
Learn more about template engines or move to a new topic?
What are template engines and why are they useful?
I want to learn how to code a Python web application using a framework.
I've built a Python spider web app, at present how do I deploy it?
What Is Jinja Templating Engine,
Source: https://www.fullstackpython.com/jinja2.html
Posted by: connobtionve.blogspot.com

0 Response to "What Is Jinja Templating Engine"
Post a Comment