Premise: the need for a remote server, know his ip, port, user, password
First, connect to a remote server
Enter the page
Pycharm menu bar, as shown below, then click Tools -> Deployment -> Configration ...
Configuring Connection Server
Under Connection, select the best protocol SFTP, fill in the next server host IP, user name and password.
After configuration, click Test SFTP connection will be found, if the connection is successful you will be prompted as follows
Under Mapping, select the connection on that part of the code and the code under windows server connected to a local Local path, server path, click OK, said that it has the local code and server code connected.
Upload Code
First, select the file you want to upload the code, can be a folder, then click Tools -> Deployment -> Upload to xxx (xxx is just take NAME)
If configured with a plurality of different servers or the same server configured with multiple servers upload path (Deployment Path), select Upload to ..., uploaded to a different server / path.
Save the code or may be configured to automatically upload i.e. Ctrl + S (default Never), Tools -> Deployment -> Options
Open comparative knowledge map, view files on a remote server
Tools -> Deployment -> Browse Remote Host to open the window of the remote server, very easy to use
Second, configure the remote server
When debugging Python programs using the premise of the server installed on the server Python interpreter, if not installed, install.
The Python interpreter to Python on a remote server
In the menu bar, File -> Settings ... -> Project ×× -> Project Interpreter, click on the right side of the Add Remote
选择SSH Credentials,之后填写上Host、User name、Password,再选择Python interpreter path(如果不知道Python安装在哪,可以远程连接服务器后,使用 命令 which python 找到Python安装位置。 )
OK,之后run代码就是在服务器上run了,手动切换解释器就可以切换远程或者本地