PyCharm¶
PyCharm is a Python cross-platform editor developed by JetBrains. PyCharm is divided into a commercial Professional version and a free Community version. Note that only the Professional version supports the remote development function. You can view the currently installed version from Help - About in the menu.
Configure remote file connections¶
Open Tools - Deployment - Configuration in the menu.
Click the Add button and select SFTP.
Fill in the name of a remote connection.
Click the button to browse the SSH configuration.
Create a new SSH configuration.
Click Copy Login Instructions in My Instance.
Extract the logged-in hostname, port number, and user from the login command. Such as ssh -p 36024 root@i-1.gpushare.com
, the extracted information is as follows.
Host | Port | User name |
---|---|---|
i-1.gpushare.com | 36024 | root |
Fill in the information in the SSH configuration and from My Instance click Copy Password and fill in the Password field. Click the Test Connection button to test the connection.
Select Yes from the Confirm Host Key button that pops up.
After the test is displayed successfully, click OK to close, and then click the OK button twice to save the SSH configuration and Deployment configuration.
Configure the remote resolver¶
Select File - Settings in the menu to open the settings.
Select Project - Python Interpreter in the menu category, click the gear icon on the right and select Add... .
Select SSH Interpreter on the left. On the right, select Existing server configuration, and select the SSH connection created in the previous step. Click Next.
Interpreter fills in /usr/local/bin/python
. Select Sync folders to set the remote server to synchronize directories.
On the right side of the directory mapping is the remote server directory, modify it to the directory that needs to be stored, and click OK.
Click Finish to complete the configuration.
The resolver has been switched to the remote resolver just configured, click OK to start synchronization, and wait for the status bar below to complete the configuration and synchronization.
The remote Python parser is displayed in the status bar in the lower right corner. At this point the running code is running on the remote host.
Open the menu Tools - Deployment, check the Automatic Upload option, and automatically synchronize the code to the server after saving the code.