This site has moved, this is just for reference, please visit the current one.

P Bergqvist

Using django-compressor on

Published: jan 11, 2012

Tags: django epio


This is a small tip to how to get django-compressor running on as smooth as possible.

  • Install django-compressor (add it to your requirements file that is) according to the docs.
  • Add this snippet to you epio.ini, this is to make a symlink to your /media, since this is the only place you can write to on, and django-compressor can only write to the same place it reads from.

    static/CACHE = ../data/CACHE
  • I never got STATICURL to work, even when I added it to COMPRESSOFFLINE_CONTEXT so I had to do a little workaround, add this to your template

    {% load static %}
    {% compress css %}
        {% get_static_prefix as STATIC_PREFIX %}
        <link rel="stylesheet" type="text/css" href="{{ STATIC_PREFIX }}css/style1.css"/>
        <link rel="stylesheet" type="text/css" href="{{ STATIC_PREFIX }}css/style2.css"/>
    {% endcompress %}

That should sum it up pretty good!

blog comments powered by Disqus

Copyright © 2012 Me. All rights reserved.