PyCharm 4.0.0 Web Help

The storage for templates can be specified on creating a Django project or a Google App Engine project ; at a later time, one can configure the directories for templates, using the Python Template Languages page of the Settings dialog.

To create a template for a view

Suppose you reference a template file that doesn't yet exist. PyCharm marks such a reference as unresolved, and provides an intention action to create a template file "from usage".

  1. Place the caret at the unresolved reference to a template.
  2. Press Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt EnterAlt EnterCommand 1, or click the yellow light bulb to show the list of available intention actions.
  3. From the suggestion list, choose action Create template <name>:

    python_createTemplate

    Create Template dialog box appears, showing the read-only template name (Template path field), and a drop-down list of possible template locations (Templates root field).

    Note that PyCharm automatically discovers the directories specified in the TEMPLATE_DIRS or TEMPLATE_LOADERS fields of the settings.py file. You can specify the other directories in addition.

  4. In the Create Template dialog box, select the template directory, where the new template will be created.

    The Template root field provides a list of possible locations for the new template. This list includes the template directories specified in the Python Template Languages page of the Settings dialog, plus the directories, which are automatically detected in the TEMPLATE_DIRS or TEMPLATE_LOADERS variables of the settings.py file.

  5. Click OK. The empty *.html file with the name in question is created in the specified location.

See Also

Procedures:

Reference:

Web Resources: