[英]Whitenoise static file upload not working with DEBUG=False
I have a Django web app and I serve static files with Whitenoise. 我有一个Django Web应用程序,并且使用Whitenoise提供静态文件。 The problem is that I can't upload and get images when
DEBUG=False
. 问题是当
DEBUG=False
时,我无法上传和获取图像。 Everything work well with DEBUG=True
but when I disable it, uploading is not working anymore but retrieving images works. DEBUG=True
时一切正常,但是当我禁用它时,上传不再起作用,但检索图像仍然有效。
Here is my whitenoise configuration : 这是我的白噪声配置:
wsgi.py wsgi.py
from whitenoise.django import DjangoWhiteNoise
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
application = DjangoWhiteNoise(application)
and settings.py 和settings.py
MEDIA_ROOT = os.path.join(BASE_DIR, 'public/static/public/images')
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
STATIC_URL = '/static/'
STATIC_ROOT = 'public/static/'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.