PyCharm allows placing breakpoints to the lines of Django template files, at the lines with Django tags or expressions.

  1. Place breakpoints in the desired lines of the Django templates:

    py_breakpointInDjangoTemplate

    Note that Django should be specified as the project template language.

  2. Launch Django server in the Debug mode. To do that, select run/debug configuration Django Server, and press Shift+F9.

    PyCharm will open the template in your browser, and suspend at the breakpoint you've set:

    py_breakpointInDjangoTemplateHit

    The Debugger session starts, and Debug tool window appears.

  3. In the Debug tool window, you can:
  • If you want to trace back exceptions that are raised in course of template debugging, open Breakpoints dialog,  and in the Django Exception Breakpoints tab, select the check box Suspend.
  • Debugging Jinja and Mako templates is not supported.

See Also

Concepts:

Procedures:

Web Resources: