How to test 500.html error page in django development env?

I prefer not to turn DEBUG off. Instead I put the following snippet in the urls.py:

if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^500/$', 'your_custom_view_if_you_wrote_one'),
        (r'^404/$', 'django.views.generic.simple.direct_to_template', {'template': '404.html'}),
    )

In the snippet above, the error page uses a custom view, you can easily replace it with Django’s direct_to_template view though.

Now you can test 500 and 404 pages by calling their urls: http://example.com/500 and http://example.com/404

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)