Possible to use WhiteNoise with Django-Compressor?

笑着哭i 提交于 2021-01-28 12:13:43

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!