Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm: Remote Development

Tags:

pycharm

How can I connect PyCharm to a remote server in order to do remote development?

  • All the files (code and data) are on a remote server.
  • The development (adding/editing files) will happen at the remote server.
  • The program will run on the remote server

I want PyCharm to act as a visual interface to that remote system? (something like terminal --> ssh --> vim but with nice PyCharm IDE)

like image 380
The Wanderer Avatar asked Aug 25 '15 18:08

The Wanderer


People also ask

Can PyCharm open a remote project?

PyCharm downloads the required version of JetBrains Client and opens the remote project inside it.

Can PyCharm connect to remote host?

An ssh server should run on a remote host, since PyCharm runs remote interpreters via ssh-sessions. If you want to copy your sources to a remote computer, create a deployment configuration, as described in the section Create a remote server configuration.

Where is remote development in PyCharm?

Connect to a remote server and open the remote projectOn the PyCharm welcome screen, select Remote Development.


2 Answers

This configuration is simpler than it seems.

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

  1. Open the Deployment page:

    • On Mac ⌘, on Windows and Linux File | Settings and click Deployment under Build, Execution, Deployment.

    • Choose Tools | Deployment | Configuration on the main menu. (see image below)

enter image description here

  1. In the left-hand pane, that shows a list of all the existing server configurations, click Add +. The Add Server dialog box opens.

enter image description here

  1. Specify the server configuration name in the Name text box. From the Type drop-down list, choose the server configuration type depending on the protocol you are going to use to exchange the data with the server. For more info about available protocols (FTP, SFTP, FTPS).

  2. Use the Visible only for this project checkbox to configure the visibility of the server access configuration.

  3. Click OK. The Add Server dialog box closes and you return to the Connection tab of the Deployment dialog box.

Mapping local folders to folders on the server and the URL addresses to access them

  1. Switch to the Mappings tab.

enter image description here

  1. In the Local Path text box, specify the full path to the desired folder in the project tree. In the simplest case it is the project root.

  2. In the Deployment Path text box, specify the folder on the server where PyCharm will upload the data from the folder specified in the Local Path text box. Type the path to the folder relative to the server configuration root.

  3. In the Web Path text box, type the path to the folder on the server relative to the server configuration root. Actually, type the relative path you typed in the Deployment Path text box.

How do I configure automatic upload of changed files to the default server

  1. Open the Options dialog:

    • Windows/Linux: File | Settings | Build, Execution, Deployment | Deployment | Options
    • MacOS X: PyCharm | Preferences | Build, Execution, Deployment | Deployment | Options

enter image description here

  1. From the Upload changed files automatically to the default server list, choose:

    • Always, to upload any manually or automatically saved file
    • On explicit save action, to upload only manually saved files
    • Never, to suppress automatic upload

That's it! You are ready to start developing.

I have just collected the most relevant information that is available in the official PyCharm documentation, and I have added some images that might guide the ones that are more visually oriented.

like image 83
lmiguelvargasf Avatar answered Oct 09 '22 07:10

lmiguelvargasf


This is how I do remote development using PyCharm:

  1. Have a copy of the codebase on local machine
  2. Go to pycharm -> tools -> Deplyoment and configure your remote destination.
  3. If you select Automatic Upload then as soon as you save any file on local machine, it will get uploaded to the remote, thereby giving you an impression of working on the remote. However, based on my experience, you should not select Automatic Upload specially if you like to save every now and then. For such cases, upload manually by right clicking the file and selecting Upload to remote once you are ready to run/test.
  4. In the terminal below, ssh to remote and run commands there.
like image 22
The Wanderer Avatar answered Oct 09 '22 06:10

The Wanderer