Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Returning Django exceptions in plain text

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 (or JSON) instead. Is there a way to do that?

like image 637
Teebes Avatar asked Nov 04 '22 15:11

Teebes


2 Answers

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.

like image 120
sandinmyjoints Avatar answered Nov 12 '22 16:11

sandinmyjoints


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.

like image 41
Ben Keating Avatar answered Nov 12 '22 17:11

Ben Keating