You might want to run python manage.py collectstatic
after you set DEBUG = False
and ALLOWED_HOSTS = ['127.0.0.1']
in settings.py
. After these two steps my web application ran well in my local server even with DEBUG=False mode.
BTW I have these settings in settings.py
.
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware', # what i added
'django.middleware.common.CommonMiddleware', # and so on...
]
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
I assume maybe whitenoise setting has something to do with collectstatic command.