Opened 15 months ago

Last modified 13 months ago

#29446 new New feature

Include template context in error page when relevant

Reported by: Shai Berger Owned by:
Component: Error reporting Version: 2.0
Severity: Normal Keywords: template debug
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes


When an error is encountered while rendering a template (in Debug mode), Django helpfully displays the template source, followed by the usual stack-trace with local variable values. It could be useful to also include the template context at the point of the error, as these are often the relevant "local variables".

While the context is actually often available as a local variable in one of the function calls close to the bottom of the stack trace, it is not obvious, and requires a somewhat tedious search (there are usually a series of calls taking a context variable, most of them irrelevant).

Change History (2)

comment:1 Changed 15 months ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:2 Changed 13 months ago by Zach Bresser


Can you elaborate on what you mean? Are you suggesting we put the local context variables in a special section instead of with the rest of the local variables?

Note: See TracTickets for help on using tickets.
Back to Top