I have deployed my app on heroku and I am serving static files using whitenoise
.
Everything works perfectly, but when I turn debug=false
the css stops being rendered.What could be the issue here? The static files are not be supplied by django but by whitenoise
.Can't figure it out.
relevant settings.py
STATIC_URL = '/static/'
STATIC_ROOT = 'staticfiles'
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
project's urls.py
urlpatterns = [
url(r'^', include('watch.urls', namespace="watch")),
url(r'^admin/', include(admin.site.urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
template's static file declaration
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'css/finale.css' %}" />
You should start by following the documentation on using WhiteNoise with Django more closely. The first difference I see is that your line:
differs from the docs:
If following that tutorial doesn't work you should make sure to include all the relevant parts of your app (e.g., I'd need to see
wsgi.py
along with the files you show above) including all theWHITENOISE_XXXXXX
settings in yoursettings.py
to figure out the issue.