django-pipeline + django-jinja

04 October 2015   2 comments   Django

Powered by Fusion×

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.
Thank you for posting a comment

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:
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:
django-semanticui-form 14 September 2015
How to no-mincss links with django-pipeline 03 February 2016
Django vs. Java 25 October 2008
Use closure for your Django context processors 09 May 2015
How and why to use django-mongokit (aka. Django to MongoDB) 08 March 2010