PyCharm 2017.1 Help

Content Root

On this page:


In the terms of PyCharm, content is a collection of files with which you are currently working, possibly organized in a hierarchy of subfolders. The folder which is the highest in this hierarchy is called content root folder or content root (shown as /help/img/idea/2017.1/folder.png) for short. A project has at least one content root folder, by default it is the project folder itself.

Having several content roots enables you to work with files from several directories that do not have a common immediate parent. This is helpful when you use some static contents, for example, icons. You can just save them all in a folder and then specify this folder as an extra content root in several projects.

Content root types

By default, all the files in a content root folder are involved in indexing, searching, parsing, code completion, etc. To change this status, folders within a content root can be assigned to the following categories:

  • Regular content roots, created as described in the section Configuring Content Roots. These roots are marked /help/img/idea/2017.1/folder.png.

    A content root is a folder that contains the files that make up your project.

  • Source roots (or source folders; shown as /help/img/idea/2017.1/rootSource.gif).

    These roots contain the actual source files and resources. PyCharm uses the source roots as the starting point for resolving imports.

    The files under the source roots are interpreted according to their type. PyCharm can parse, inspect, index, and compile the contents of these roots.

  • Resource roots (or resource folders; marked as /help/img/idea/2017.1/rootResourceIJ.png).

    These roots are intended for resource files in your application (images, style sheets. etc.) By assigning a folder to this category, you tell PyCharm that files in it and in its subfolders can be referenced relative to this folder instead of specifying full paths to them.

  • Excluded roots (shown as /help/img/idea/2017.1/rootExcluded.gif) are ones that PyCharm "almost ignores".

    These roots contain files and folders ignored by PyCharm when indexing, searching, parsing, watching etc.

    Excluded roots are not visible to PyCharm. Usually, one would like to exclude temporary build folders, generated output, logs, and other project output. Excluding the unnecessary paths is a good way to significantly improve performance.

  • Template roots marked as /help/img/idea/2017.1/template_folder_icon.png contain templates for the various web projects.

See Also

Last modified: 26 July 2017