开发者

Returning Django exceptions in plain text

开发者 https://www.devze.com 2023-03-30 19:15 出处:网络
Errors caught by Django in DEBUG mode are returned in HTML-formatted code for browser display. I\'d like to have those errors display in plain text 开发者_如何学Go(or JSON) instead. Is there a way to

Errors caught by Django in DEBUG mode are returned in HTML-formatted code for browser display. I'd like to have those errors display in plain text 开发者_如何学Go(or JSON) instead. Is there a way to do that?


I think you could modify the templates found in this file: https://code.djangoproject.com/browser/django/trunk/django/views/debug.py

Change TECHNICAL_500_TEMPLATE, TECHNICAL_404_TEMPLATE, and EMPTY_URLCONF_TEMPLATE to display plaintext.


Not a direct solution, but perhaps throwing django-sentry into the mix would allow you to do something more with the errors reported? Im still new to it myself.

0

精彩评论

暂无评论...
验证码 换一张
取 消