I have a production and local DJANGO development environment. To push things to production we have a deployer which minifies and gzips all CSS and JS files.
To serve them on production I need to call them like
<link rel="stylesheet" href="{{ STATIC_URL }}css/filename.min.css.gz">
However on development I want the normal css file served (that way I don't have to re-minify and gzip each time I save) with:
<link rel="stylesheet" href="{{ STATIC_URL }}css/filename.css">
Is there any way to achieve and automatize this behaviour by adding something to the deployer?, is there some other work-around (I could get rid of the .min extension if it's possible to add the .gz in a clean way?
I want to note the I know I could implement some html-parser which adds it on each deploy but I'm looking for a neat and django oriented solution.
As usual, there's a Django package for that! There are two I use:
django-compressor: http://django-compressor.readthedocs.org/en/latest/ django-pipeline: https://django-pipeline.readthedocs.org/en/latest/
I started on django-pipeline but have moved to using compressor as of late. See the docs, I believe one will be what you're looking for. Good luck!