Hacker News new | ask | show | jobs
by jonasvp 5419 days ago
Just use django-compressor (https://github.com/jezdez/django_compressor). It does this as well as minifying and compressing static assets.
1 comments

django-compressor uses the file modification time to assign a different filename to the file - unfortunately, this doesn't work so well if you are deploying from multiple machines. I much prefer using a hash of the file contents, since that is guaranteed to change if and only if the file itself has changed.

In fact, I'll file a bug suggesting this on django_compressor right now.

Django compressor has another issue on load balanced environments: the cached key uses the hostname of the machine , which really made it impractical for us. I promised Jannis a clean patch for this, but haven't found the time to do so...

In our case we have a utility machine that compiles media and deployes it but that machine doesn't even run a webserver at all...

https://github.com/jezdez/django_compressor/blob/develop/com...

django-compress, while a little older than django-compressor, supports versioning based on a hash of the file contents. I've been pretty happy with it. https://github.com/pelme/django-compress