django-pipeline + django-jinja

04 October 2015   2 comments   Django

Mind that age!

This blog post is 5 years old! Most likely, its content is outdated. Especially if it's technical.

Do you have django-jinja in your Django 1.8 project to help you with your Jinja2 integration, and you use django-pipeline for your static assets?
If so, you need to tie them together by passing pipeline.templatetags.ext.PipelineExtension "to your Jinja2 environment". But how? Here's how:

# in your

from django_jinja.builtins import DEFAULT_EXTENSIONS

        'BACKEND': 'django_jinja.backend.Jinja2',
        'APP_DIRS': True,
        'OPTIONS': {
            'match_extension': '.jinja',
            'context_processors': [
            'extensions': DEFAULT_EXTENSIONS + [

Now, in your template you simply use the {% stylesheet '...' %} or {% javascript '...' %} tags in your .jinja templates without the {% load pipeline %} stuff.

It took me a little while to figure that out so I hope it helps someone else googling around for a solution alike.



Why you are using django_jinja when there is built in support for jinja2 template from django 1.8+?

Peter Bengtsson

I honestly can't remember now. The documentation lists its features:

The reason I use it is because I built my project from Sugardough which is the Mozilla Django best practice project.

Your email will never ever be published

Related posts

Using Lovefield as an AJAX proxy maybe 30 September 2015
localStorage is not async, but it's FAST! 06 October 2015
Related by Keyword:
django-pipeline and Zopfli 15 August 2018
Find static files defined in django-pipeline but not found 25 July 2017
How to no-mincss links with django-pipeline 03 February 2016