Learning Jinja2
- Installing and Using
- Variable Interpolation
- Including Files
- Template Inheritance and Blocks
- Control Blocks
Jinja2 is a template engine for Python featuring an optional sandbox environment.
Installing
Jinja2 is one of many packages available via PIP.
pip install jinja2
Note: Some environments and platforms like Heroku have different installation methods for packages. Consult the documentation of web services and online platforms for their instructions.
Using
Once installed, Jinja2 can accessed through the normal package methods of the using the from… import.

The Template() function loads some texts that contains text containing symbols to be changed during rendering. Once created, the render() function converts (interpolates) text based on variable and other names into their values.