File templates are specifications of the contents to be generated when creating a new file. They let you create the source files that already contain some initial code. File templates are written in the Velocity Template Language (VTL).

PyCharm enables the following ways of creating file templates:

  1. Open the File Templates dialog box and switch to the Templates tab.
  2. Click the Copy button copy on the toolbar and change the template name, extension, and source code as required.
  3. Apply the changes and close the dialog box.
  1. Open the desired file in the editor.
  2. On the main menu, choose Tools | Save File as Template.
  3. In the File Templates dialog box that opens specify the new template name and edit the source code, if necessary.
  4. Apply the changes and close the dialog box.
  1. In the File Templates dialog box, switch to the Includes tab.
  2. Click the Add button add.png on the toolbar and specify include template name, extension, and the source code.
  3. In the Templates tab, select the desired template and click the Edit button.
  4. To include a template, insert the #parse directive in the source code.

See Also

Concepts:

Reference:

Web Resources: