Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install jingo

How to install jingo

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install jingo
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.6.1Never BuiltWhy not?
0.5 Available View build log
0.4 Available View build log
Windows (64-bit)
0.6.1Never BuiltWhy not?
0.4 Available View build log
Mac OS X (10.5+)
0.6.1Never BuiltWhy not?
0.5 Available View build log
0.4 Available View build log
Linux (32-bit)
0.6.1Never BuiltWhy not?
0.5 Available View build log
0.4 Available View build log
Linux (64-bit)
0.6.1 Available View build log
0.5 Available View build log
0.4 Available View build log
Depended by
Lastest release
version 0.6.1 on Jan 9th, 2014

System Message: ERROR/3 (<string>, line 2)

Unknown directive type "module".

.. module:: jingo

Jingo is an adapter for using Jinja2 templates within Django.


Coffin or Jingo?

Jingo differs from Coffin in two major ways:

  • Jingo serves purely as a minimalistic bridge between Django and Jinja2. Coffin attempts to reduce the differences between Jinja2 templates and Django's native templates.
  • Jingo has a far supperior name, as it is a portmanteau of 'Jinja' and Django.


When configured properly (see Settings below) you can render Jinja2 templates in your view the same way you'd render Django templates:

from django.shortcuts import render

def MyView(request):
    # TODO: Do something.
    context = dict(user_ids=[1, 2, 3, 4])
    render('users/search.html', context)


Not only does ``django.shorcuts.render`` work, but so does any method that
Django provides to render templates.


You'll want to use Django to use jingo's template loader. In settings.py:


This will let you use django.shortcuts.render or django.shortcuts.render_to_response.

You can optionally specify which filename patterns to consider Jinja2 templates:

JINGO_INCLUDE_PATTERN = r'\.jinja2'  # use any regular expression here

This will consider every template file that contains the substring .jinja2 to be a Jinja2 file (unless it's in a module explicitly excluded, see below).

And finally you may have apps that do not use Jinja2, these must be excluded from the loader:

JINGO_EXCLUDE_APPS = ('debug_toolbar',)

If a template path begins with debug_toolbar, the Jinja loader will raise a TemplateDoesNotExist exception. This causes Django to move onto the next loader in TEMPLATE_LOADERS to find a template - in this case, django.template.loaders.filesystem.Loader.


Technically, we're looking at the template path, not the app. Often these are the same, but in some cases, like 'registration' in the default setting--which is an admin template--they are not.

The default is in jingo.EXCLUDE_APPS:


If you want to configure the Jinja environment, use JINJA_CONFIG in settings.py. It can be a dict or a function that returns a dict.

JINJA_CONFIG = {'autoescape': False}


    return {'the_answer': 41 + 1}

Template Helpers

Instead of template tags, Jinja encourages you to add functions and filters to the templating environment. In jingo, we call these helpers. When the Jinja environment is initialized, jingo will try to open a helpers.py file from every app in INSTALLED_APPS. Two decorators are provided to ease the environment extension:

System Message: ERROR/3 (<string>, line 113)

Unknown directive type "function".

.. function:: jingo.register.filter

    Adds the decorated function to Jinja's filter library.

System Message: ERROR/3 (<string>, line 117)

Unknown directive type "function".

.. function:: jingo.register.function

    Adds the decorated function to Jinja's global namespace.

System Message: ERROR/3 (<string>, line 122)

Unknown directive type "highlight".

.. highlight:: jinja

Default Helpers

Helpers are available in all templates automatically, without any extra loading.

System Message: ERROR/3 (<string>, line 130)

Unknown directive type "automodule".

.. automodule:: jingo.helpers

Template Environment

A single Jinja Environment is created for use in all templates. This is available as jingo.env if you need to work with the Environment.


Since we all love L10n, let's see what it looks like in Jinja templates:

<h2>{{ _('Reviews for {0}')|f(addon.name) }}</h2>

The simple way is to use the familiar underscore and string within a {{ }} moustache block. f is an interpolation filter documented below. Sphinx could create a link if I knew how to do that.

The other method uses Jinja's trans tag:

{% trans user=review.user|user_link, date=review.created|datetime %}
  by {{ user }} on {{ date }}
{% endtrans %}

trans is nice when you have a lot of text or want to inject some variables directly. Both methods are useful, pick the one that makes you happy.


Django marks its form HTML "safe" according to its own rules, which Jinja2 does not recognize.

System Message: ERROR/3 (<string>, line 168)

Unknown directive type "automodule".

.. automodule:: jingo.monkey


Testing is handle via fabric:

fab test

Subscribe to package updates

Last updated Jan 9th, 2014

Download Stats

Last month:8

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.