P Bergqvist

Using django-compressor on ep.io

Published: jan 11, 2012

Tags: django epio

Comments:  

0

This is a small tip to how to get django-compressor running on ep.io 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 ep.io, and django-compressor can only write to the same place it reads from.

    [symlinks]
    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!

Article Links

  1. jezdez/django_compressor - GitHub
  2. Epio | Smart Python hosting
blog comments powered by Disqus

Copyright © 2012 Me. All rights reserved.