PyCharm 2024.2 Help

Connect to a web server

PyCharm distinguishes among the following three types of "local development — deployment server" configurations:

  • In-place server configuration.

    In an in-place server configuration, you are using a local web server, but unlike with the local server configuration, don't upload/download or synchronize files between the PyCharm project and the project folder in the server file structure. Instead, you open the project folder from the server document root directly in PyCharm, and thus do the development on the server directly.

    Create an in-place server configuration

  • Local server configuration.

    A local server is a server that runs in a local or mounted folder and serves files to a local URL address. In a local server configuration, you do the development in a PyCharm project, and then upload the project files to the document root on the server.

    Create a local server configuration

  • Remote server configuration.

    In a remote server configuration, the server runs on another computer (a remote host). To access files on the remote server, use FTP/SFTP/FTPS/WebDAV protocols.

    Create a remote server configuration

Before you start

Enable the FTP/SFTP/WebDAV Connectivity plugin

This functionality relies on the FTP/SFTP/WebDAV Connectivity plugin, which is bundled and enabled in PyCharm by default. If the relevant features are not available, make sure that you did not disable the plugin.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Installed tab, find the FTP/SFTP/WebDAV Connectivity plugin, and select the checkbox next to the plugin name.

You can define as many configurations as necessary, thus enabling flexible switching between upload/download setups.

If you need to deploy code to multiple servers, you can create a server group and avoid deploying to each server individually.

Server access configuration

PyCharm controls interaction with servers through server access configurations. Anytime you are going to use a server, you need to define a server access configuration, no matter whether your server is on a remote host or on your machine.

A server access configuration defines the following:

  • The server type (in-place, local, or remote).

  • The computer (host) where the server is running. For in-place and local servers, PyCharm presupposes that it is the current computer where your project is.

  • The server access configuration root: the highest folder in the server hierarchy that can be accessed through the server configuration.

  • The URL address to access the server configuration root.

  • The protocol to transfer the data through and the connection parameters.

  • The correspondence between local folders (that is, the folders under the project root), destination folders on the server (either local or remote), and URL addresses to access the data on the server. This correspondence is called mapping.

    For example, your project is stored under C:/Projects/My_Project/ and contains a folder C:/Projects/My_Project/My_Folder, while a local server has the document root under C:/xampp/htdocs. You upload the entire project tree to C:/xampp/htdocs/My_Project. In the PyCharm terms, the C:/Projects/My_Project/My_Folder folder is referred to as local and the C:/xampp/htdocs/My_Project/My_Folder folder is referred to as remote.

You can define as many configurations as necessary, thus enabling flexible switching between upload/download setups.

If you need to deploy code to multiple servers, you can create a server group and avoid deploying to each server individually.

Default server access configuration

You can set a server configuration as default to have PyCharm silently apply it in the following cases:

  1. In the Settings dialog (Ctrl+Alt+S) , go to Build, Execution, Deployment | Deployment, select the required server access configuration in the central pane, and click the Use as default button on the toolbar.

    Alternatively, click the Default Deployment Server widget in the PyCharm status bar and select the desired server or server group from the popup menu.

  2. To configure the upload to the default server, go to Build, Execution, Deployment | Deployment | Options.

Last modified: 24 June 2024