I use Django Compressor to manage my coffee and smaller coffee files, as well as for development, but I had some problems to get it working for my production deployment.
My idea is to have apache to host static files, possibly on another server. I install COMPRESS_OFFLINE = Truein a file settings.py.
Then i do the following
python manage.py compress- This fills the directory CACHEin my directory static, where all static files will be collected.python manage.py collectstatic- collects static files from all applications of my project (some of which do not use a compressor) in my directory static.- Copy the directory
staticsomewhere where apache will be hosted. And configure apache to serve files. - Change the variable
static_urlin the file settings.pyto point to a static server.
If I open any page, I get the following error on my server, this seems to happen when I have DEBUG = Falseand COMPRESS_OFFLINE = Truein my file settings.py:
TemplateSyntaxError: Caught OfflineGenerationError when rendering: You have offline compression disabled, but the key "777ba26736d046ab043dc151e7e9a060" is not in the offline manifest. You may need to run "python manage.py compress".
When I check the directory static/CACHE, I confirm that it says an error, this is my file manifest.json:
{
"6189b8598993d1cbdbd35d4dfd1a6711": "<script type=\"text/javascript\" src=\"http://192.168.1.123/CACHE/js/2f6ca6616bd6.js\"></script>",
"5c66dbed0e5b766c6e32773cd8585f3c": "<link rel=\"stylesheet\" href=\"http://192.168.1.123/CACHE/css/154d95903951.css\" type=\"text/css\" />"
}
CACHE python manage.py compress, , , .
, , . ? ?
.