aayushdagra
aayushdagra

Reputation: 189

How to simulate HTTP error 500 in django?

I have set a HTML page 500.html in my main direcroty. It will show this page when HTML 500 Internal Server Error occurs.

How can I generate this error to check if it works?

I'm gussesing I should somehow raise exception of some sort.

How do I do that?

Upvotes: 1

Views: 2956

Answers (1)

Murali
Murali

Reputation: 1114

Try editing the urls.py as follows:

if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^500/$', 'django.views.defaults.server_error'),
    )

Then try accessing the page as follows:

http://localhost/500

http://yoursite.com/500

Upvotes: 2

Related Questions