PyCharm 2017.2 Help

Creating an In-Place Server Configuration

Basics

An in-place server is a server whose document root is the parent of the project root, either immediate or not. In other words, the Web server is running on your computer, your project is under its document root, and you do your development directly on the server.

To configure access to the server in this set-up, you only need to specify the URL address of the sever document root, appoint the project root folder, and specify the URL address to access it.

Creating a server configuration: specifying its name, type, and visibility

  1. Open the Deployment page by doing one of the following:
    • Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or PyCharm | Preferences for macOS, and click Deployment under Build, Execution, Deployment.
    • Choose Tools | Deployment | Configuration on the main menu.
  2. In the left-hand pane, that shows a list of all the existing server configurations, click the Add toolbar button add.png. The Add Server dialog box opens.
  3. Specify the server configuration name in the Name text box. From the Type drop-down list, choose the server configuration type In-place. Use the Up and Down keyboard keys to scroll through the list of server configuration types.
  4. Use the Visible only for this project check box to configure the visibility of the server access configuration (deployment configuration).
    • Select the check box to restrict the use of the configuration to the current project. Such configurations cannot be reused outside the current project, they do not appear in the list of available configurations in other projects.
    • When the check box is cleared, the configuration is visible in all PyCharm projects and the settings from, including SSH credentials, can be reused.
  5. Click OK. The Add Server dialog box closes and you return to the Connection tab of the Deployment node.

Configuring access to an in-place server: specifying the URL address of the server document root

In the Web server root URL text box, type the URL address associated with the document root of your Web server as defined in the Web server configuration file. This URL address will be the starting point for building the URL address of your application. Both the HTTP and the HTTPS protocols are supported.

To access a server through HTTPS, you need to acquire a certificate file <certificate_name>.cert signed by a recognized authority and import this certificate in the truststore/keystore of the Oracle JRE (Java Runtime Environment) on which PyCharm runs. Note that self-signed certificates are rejected as unsafe.

To import a certificate in Oracle JRE:

  1. Open the embedded Terminal and type the following command:
    <jre_home>/bin/keytool.exe -importcert -keystore <path to jre truststore/keystore> -file <full_path_to_<cert_name>.cert>
    If you are using the Oracle JRE bundled with PyCharm, the default path to the truststore/keystore is <%product_installation_folder>/jre/jre/lib/security/jssecacerts or <%product_installation_folder>/jre/jre/lib/security/cacerts.

    Otherwise it is <jre_home>/jre/lib/security/jssecacerts or <jre_home>/jre/lib/security/cacerts.

  2. When asked to enter a password for the truststore/keystore, specify the default one changeit.
  3. Open the PyCharm.exe.vmoptions file in the <PyCharm_installation_folder>/bin and add the following line to it:
    -Djavax.net.ssl.keyStore=<path to keystore>
  4. Restart PyCharm.

Learn more at Java6 and Java7.

For example, the Apache httpd server configuration file is httpd.conf. The default document root is the htdocs folder and the default URL address to access the data in it is http://localhost. If you have changed the default port 80, you have to specify the port explicitly: http://localhost:<port>.

Specifying the project root folder and the URL address to access it

  1. Switch to the Mappings tab.
  2. In the Local path text box, specify the full path to your project root folder. Type the path manually, or click the Browse button /help/img/idea/2017.2/browseButton.png and choose the folder in the dialog box, that opens.
  3. In the Web path on server text box, type the path to the project root folder relative to the server document root specified in the server configuration file. As you type, PyCharm dynamically builds the URL address through which your project root folder will be accessible and shows it as a link in the Project URL read-only field. To check that the URL address is constructed correctly and ensures access to the project root, click the link.
Last modified: 26 October 2017

See Also