django-pipeline + django-jinja

04 October 2015   2 comments   Django

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
Related by Text:
jQuery and Highslide JS 08 January 2008
I'm back! has been renewed 05 June 2005
Anti-McCain propaganda videos 12 August 2008
Ever wondered how much $87 Billion is? 04 November 2003
Guake, not Yakuake or Yeahconsole 23 January 2010