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

后端 未结 10 1328
情话喂你
情话喂你 2020-12-28 13:00

I am using Django for a project and is already in production.

In the production environment 500.html is rendered whenever a server error occurs.

How do I tes

10条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-28 13:41

    You can simply define the handler404 and handler500 for errors in your main views.py file as detailed in this answer:

    https://stackoverflow.com/a/18009660/1913888

    This will return the error that you desire when Django routes to that handler. No custom URL configuration is needed to route to a different URL name.

提交回复
热议问题