I'm hosting my Django application on Heroku and using whitenoise to handle serving static files.
Following is content of settings.py
DEBUG = False
ALLOWED_HOSTS += [
'example.com',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
...
]
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static_my_project')
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static_cdn', 'static_root')
But static files are not working.
Setting Debug=True
is serving static files but not when Debug=False
.