PyCharm 4.0.0 Web Help

Some features described here are available in the Professional edition only.

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

Prerequisite

Django is specified as the project template language.

To do that, open the Project Settings dialog, under the Project Settings select page Python Template Languages, select project where the templates reside, and then choose Django from the Template Language drop-down list.

py_configuringTemplateLanguage

To debug a Django template, follow these general steps
  1. Place breakpoints in the desired lines of the Django templates:

    py_breakpointInDjangoTemplate

  2. Launch Django server in the Debug mode.

    This is how it's done:

    1. On the main menu, choose Run | Edit Configurations.
    2. If the desired Django Server run/debug configuration exists, select it, otherwise create a new one, as described in the section Creating and Editing Run/Debug Configuration.
    3. Then click the button debug on the main toolbar, or press Shift+F9Shift+F9Shift+F9Shift+F9Shift+F9Alt+F5Ctrl+F5Shift+Alt+D or Shift+F9Control DShift F9Command F11.

    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:

Please note the following:

  • 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: