Jinja2 Documentation

# Jinja

Welcome to Jinja2 | Introduction »

# Welcome to Jinja2

Jinja2 is a modern and designer friendly templating language for Python, modelled after Django’s templates. It is fast, widely used and secure with the optional sandboxed template execution environment:

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

Features:

- sandboxed execution
- powerful automatic HTML escaping system for XSS prevention
- template inheritance
- compiles down to the optimal python code just in time
- optional ahead of time template compilation
- easy to debug. Line numbers of exceptions directly point to the correct line in the template.
- configurable syntax

## Jinja2 Documentation

- Introduction
  - Prerequisites
  - Installation
  - Basic API Usage
  - Experimental Python 3 Support
- API
  - Basics
  - Unicode
  - High Level API
  - Autoescaping
  - Notes on Identifiers
  - Undefined Types
  - The Context
  - Loaders
  - Bytecode Cache
  - Utilities
  - Exceptions
  - Custom Filters
  - Evaluation Context
  - Custom Tests
  - The Global Namespace
  - Low Level API
  - The Meta API
- Sandbox
- Template Designer Documentation
  - Synopsis
  - Variables
  - Filters
  - Tests
  - Comments
  - Whitespace Control
  - Escaping
  - Line Statements
  - Template Inheritance
  - HTML Escaping
  - List of Control Structures
  - Import Context Behavior
  - Expressions
  - List of Builtin Filters
  - List of Builtin Tests
  - List of Global Functions
  - Extensions
  - Autoescape Extension
- Extensions
  - Adding Extensions
  - i18n Extension
  - Expression Statement
  - Loop Controls
  - With Statement
  - Autoescape Extension
  - Writing Extensions
- Integration
  - Babel Integration
  - Pylons
  - TextMate
  - Vim
- Switching from other Template Engines
  - Jinja1
  - Django
  - Mako
- Tips and Tricks
  - Null-Master Fallback
  - Alternating Rows
  - Highlighting Active Menu Items
  - Accessing the parent Loop

## Additional Information

- Frequently Asked Questions
  - Why is it called Jinja?
  - How fast is it?
  - How Compatible is Jinja2 with Django?
  - Isn’t it a terrible idea to put Logic into Templates?
  - Why is Autoescaping not the Default?
  - Why is the Context immutable?
  - What is the speedups module and why is it missing?
  - My tracebacks look weird. What’s happening?
  - Why is there no Python 2.3 support?
  - My Macros are overriden by something
- Jinja2 Changelog
  - Version 2.5.3
  - Version 2.5.2
  - Version 2.5.1
  - Version 2.5
  - Version 2.4.1
  - Version 2.4
  - Version 2.3.1
  - Version 2.3
  - Version 2.2.1
  - Version 2.2
  - Version 2.1.1
  - Version 2.1
  - Version 2.0
  - Version 2.0rc1

If you can’t find the information you’re looking for, have a look at the index of try to find it using the search function:

- Index
- Search Page