问题
I'm new with Django, and I'm trying to automate and optimize my deployment for production. At this moment I use WhiteNoise to handle static files, but as far as I know he just handle and compress the static files.
Recently I found out about this tool: https://github.com/django-compressor/django-compressor , but I don't know if it really worth it to drop WhiteNoise in order to use this Django-Compressor, since I've never heard of it and every guide recommends to use WhiteNoise for safety and stability reasons.
It's possible to use both in the same project? If yes, how? If not, worth changing it to use in a PaaS like Heroku?
回答1:
It should be possible to use WhiteNoise and Django Compressor together. You will need to use Django Compressor's offline compression mode and, if you are using Heroku, you will need to add a bin/post_compile
script to run the compression.
See this ticket for details: https://github.com/django-compressor/django-compressor/issues/486#issuecomment-258909167
来源:https://stackoverflow.com/questions/46740385/possible-to-use-whitenoise-with-django-compressor