Previewing Django Error Pages

A quick hack to preview your Django error pages when DEBUG=True…

Simply add routes to your error pages as part of your, but only when you’re running in debug mode.

from django.views.generic import TemplateView
if settings.DEBUG:
# enable local preview of error pages
urlpatterns += patterns('',
(r'^403/$', TemplateView.as_view(template_name="403.html")),
(r'^404/$', TemplateView.as_view(template_name="404.html")),
(r'^500/$', TemplateView.as_view(template_name="500.html")),

view raw
hosted with ❤ by GitHub

Now you can simply browse to /403/, /404/ or /500/ to see what they look like.