python - CSS not rendered in custom template for 404 and 500 pages django 1.8 -
this folder structure
music -music -feature -static -feature core.css -css other css files -js -img -templates 404.html 500.html index.html -feature about.html detail.html template.html manage.py
views.py
django.shortcuts import render def error404(request): return render(request,'404.html')
urls.py
urlpatterns = [ url(r'^featured/(?p<pk>[0-9]+)/$', views.detailview.as_view(), name='detail'), url(r'^about/$', views.about, name='about'), url(r'^faq/$', views.faq, name='faq'), ] handler404 = 'mysite.views.error404'
the custom 404.html file gets rendered no css.and css works fine on other pages when set debug=false
to check custom 404 error page in settings.py
css entire project disappears. folder structure or other problem? edit: core.css
main css file , part other css files
contains css plugins
it's serving static files. when use debug = true
django takes care them otherwise server should it. django in debug mode uses view. warning there:
this view work if debug true.
that’s because view grossly inefficient , insecure. intended local development, , should never used in production.
you can run server --insecure
option test 404 error or can explicilty create url page check styling:
use --insecure option force serving of static files staticfiles app if debug setting false. using acknowledge fact it’s grossly inefficient , insecure. intended local development, should never used in production , available if staticfiles app in project’s installed_apps setting. runserver --insecure doesn’t work cachedstaticfilesstorage.
Comments
Post a Comment