PyCharm 2019.2 Help

Configuring content roots

Any project contains at least one content root created together with the project. You can create additional content roots as well as remove the unnecessary ones.

Create a content root

  1. Open the Project Structure settings.

  2. In the Projects pane of the Project Structure page, click the project you want to configure content roots for.

  3. In the Content roots of the Project Structure page, click the Add Content Root button Add Content Root.

  4. In the dialog that opens, locate the desired directory and click OK.

    Add Content Root

Remove a content root

  1. Open the Project Structure settings.

  2. In the Projects pane of the Project Structure page, click the project you want to configure content roots for.

  3. In the Content roots pane of the Project Structure page, select the content root that you want to delete.

  4. Click the Remove button Remove content root and confirm removal.

    Remove content root

Specifying folder categories

Here is how you assign a folder to a different category. In a similar way, you can assign a folder to any other category. This can be done both in the Project tool window and on the Project Structure page of the Settings/Preferences dialog.

To assign a category to a folder in the Project tool window, follow these steps

  1. Open the Project tool window (for example View | Tool Windows | Project).

  2. Select the folder that you want to assign to a certain category.

  3. In the context menu, point to Mark Directory As and select the desired category.

    Mark directory in the Project tool window

In a similar way you can change the folder category at a later time. (Just select a different category from the context menu.)

To cancel the folder association with its current category (that is to make a folder an "ordinary" folder Folder), select Unmark as <current_category> Root. (for example Unmark as Test Sources Root).

To assign a category to a folder in the Project Structure page, follow these steps

  1. Open Project Structure page of the Settings/Preferences dialog.

  2. Select the folder you want to assign a category to.

  3. Click the category button, for example, root_Source.png.

Excluding files and folders by name patterns

You can make files and folders excluded by specifying the name patterns. Use the Exclude files field to specify the patterns.

Exclude by name pattern
Last modified: 6 November 2019