Django 500 message in custom template

后端 未结 2 1381
长发绾君心
长发绾君心 2021-02-20 10:47

I have a 500.html template which gets loaded whenever my app explodes but I wanted to know if there\'s any way I can output the exception\'s message in the template?

So

2条回答
  •  终归单人心
    2021-02-20 11:39

    I know this is an old thread, but I just wanna to make it clear:

    The answer is correct if you want a custon view! The default view will load a 500.html (also 404.html and others), from the main templates directory of your project if it's there.

    So, if all you need is to change static page content, like insert some images in your error page, all you have to do is to create a template file at this place.

提交回复
热议问题