Opened 2 years ago

Last modified 6 months ago

#29446 assigned New feature

Include template context in error page when relevant

Reported by: Shai Berger Owned by: Vibhu Agarwal
Component: Error reporting Version: 2.0
Severity: Normal Keywords: template debug
Cc: Min ho Kim, Vibhu Agarwal 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 (6)

comment:1 Changed 2 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:2 Changed 2 years 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?

comment:3 Changed 11 months ago by Min ho Kim

Hi Shai Berger,
Could you give some more information about this feature request?
It would be nice to have some example of error page you would like to see.

If anyone else has any idea what the expected error page should look like, please comment.

comment:4 Changed 11 months ago by Min ho Kim

Cc: Min ho Kim added

comment:5 Changed 6 months ago by Vibhu Agarwal

Cc: Vibhu Agarwal added

comment:6 Changed 6 months ago by Vibhu Agarwal

Owner: set to Vibhu Agarwal
Status: newassigned
Note: See TracTickets for help on using tickets.
Back to Top