Title: Django: "readable" 500 page for http clients?
Tags: python;django
Question: On server error (500), the default debugging behavior of django is to return an HTML page containing the stack trace. 

However, I'm using django (with rest framework) to create REST api, so I'm accessing it through command line tools, and the returned html is unreadable.

Is there any way to customize django to return a more readable, text only response?

Comment: This is what you are looking for https://www.django-rest-framework.org/api-guide/exceptions/ and https://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views

Comment: @pako: thanks. I saw that, but it says that it is by-passed in debug mode



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2019:00:05/22/19', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<python><django>', 'Title': 'Django: "readable" 500 page for http clients?', 'ViewCount': 25, 'id': 56258066, 'user_AboutMe': '', 'user_AccountId': 3826509.0, 'user_DisplayName': 'blue_note', 'user_Reputation': 25983.0, 'user_Views': 1136.0, 'user_id': 3208297.0}}