可以将 WhiteNoise 与 Django-Compressor 一起使用吗? [英] Possible to use WhiteNoise with Django-Compressor?

查看:56
本文介绍了可以将 WhiteNoise 与 Django-Compressor 一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Django 的新手,我正在尝试自动化和优化我的生产部署.目前我使用 WhiteNoise 来处理静态文件,但据我所知他只是处理和压缩静态文件.
最近我发现了这个工具:https://github.com/django-compressor/django-压缩器 ,但我不知道为了使用这个 Django-Compressor 是否真的值得放弃 WhiteNoise,因为我从来没有听说过它,每个指南都建议使用 WhiteNoise 以确保安全和稳定性.

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.

可以在同一个项目中同时使用两者吗?如果是,如何?如果没有,是否值得将其更改为在像 Heroku 这样的 PaaS 中使用?

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?

推荐答案

WhiteNoise 和 Django Compressor 应该可以一起使用.您将需要使用 Django Compressor 的离线压缩模式,如果您使用的是 Heroku,则需要添加一个 bin/post_compile 脚本来运行压缩.

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.

详情见这张票:https://github.com/django-compressor/django-压缩机/问题/486#issuecomment-258909167

这篇关于可以将 WhiteNoise 与 Django-Compressor 一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆