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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s