[英]Why static files are served on Heroku without activating WhiteNoise?
I followed a tutorial on deploying Django app on Heroku server and I stumble across this:我遵循了在 Heroku 服务器上部署 Django 应用程序的教程,我偶然发现了这个:
MIDDLEWARE = [ 'whitenoise.middleware.WhiteNoiseMiddleware', ]
But omitted to activate it inside wsgi.py file:但省略在wsgi.py文件中激活它:
from whitenoise import WhiteNoise
from my_project import MyWSGIApp
application = MyWSGIApp()
application = WhiteNoise(application, root='/path/to/static/files')
application.add_files('/path/to/more/static/files', prefix='more-files/')
Why the static files are served on the production site?为什么在生产站点上提供 static 文件? Should not the above code be responsible for this?
上面的代码不应该对此负责吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.