I’d like to propose a new feature/setting to address a developer experience regression introduced by the recent changes in Ticket #36456 (Improved content type negotiation for 500 response).
The Problem: Ticket #36456 modified django.views.debug.technical_500_response to strictly respect the client’s Accept header. While this is technically correct, it heavily impacts a common debugging workflow.
Many developers rely on the HTML response in Chrome DevTools’ (or other browsers’) Network Preview tab to read Django’s rich 500 error page when debugging API calls (fetch/XHR). Because these JavaScript requests often don’t explicitly prefer text/html, Django now returns the plain text traceback. The plain text version is much harder to read and navigate in the browser console or network tab compared to the interactive HTML debug page.
Why not just fix the frontend? Updating the Accept header across different frontend systems just to accommodate local debugging is time-consuming. Furthermore, it risks breaking existing production logic, as many frontend conditions depend on the request’s content type behaving normally.
Proposed Solution: Introduce a new setting (for example, DEBUG_TECHNICAL_ERROR_FORMAT = "text/html" or similar) that allows developers to opt-in to the legacy behavior when DEBUG = True. If this setting is enabled, Django would always return the rich HTML debug page upon a crash, bypassing the strict content-type negotiation.
I believe this would restore a beloved part of Django’s developer experience for SPAs and API-heavy projects without rolling back the correctness achieved in #36456.
I would love to hear your thoughts on this!