Template Interface

This interface is useful for template engine specific reporting when regular stacktraces do not contain template data. This for instance is required in the Django framework where the templates do not integrate into the Python stacktrace.

A rendered template. This is generally used like a single frame in a stacktrace and should only be used if the template system does not provide proper stacktraces otherwise.

The attributes filename, context_line, and lineno are required.


The line number of the call


The absolute path to the template on the file system


The filename as it was passed to the template loader


Source code in filename at lineno


A list of source code lines before context_line (in order) – usually [lineno - 5:lineno]


A list of source code lines after context_line (in order) – usually [lineno + 1:lineno + 5]

"template": {
  "abs_path": "/real/file/name.html"
  "filename": "file/name.html",
  "pre_context": [
  "context_line": "line3",
  "lineno": 3,
  "post_context": [
In this guide