当前位置: 动力学知识库 > 问答 > 编程问答 >

django - Catching error stacktraces when DEBUG = False

问题描述:

I catch an error whenever I turn my project to DEBUG = False, and since no exceptions are printed, all I get is a You need to create a 500.html template. error message. How can I see the stacktrace of the original error in the manage.py runserver output?

Alternatively, can I create a 500 template which prints out the exception?

网友答案:

To see the output of the runserver -commands stack trace its just a matter of looking at the terminal its running in.

For the 500 page, What would the use case of this be? runserver shouldn't be used outside of DEBUG=True and any real web server would log the error in a file. but to answer your question, i dont think it can be done, and shouldn't be done as your stacktraces can contain sensitive information.

网友答案:

As per @Cat Plus Plus, I needed to set up my SMTP connection to get email notifications of the errors. They included the stacktraces I needed to hear.

分享给朋友:
您可能感兴趣的文章:
随机阅读: