This is the funny part, how we can set up the remote interpreter so you execute the scripts on your remote machine. Let’s get started, start up PyCharm and create a new Python project.
Open “Preferences > Project > Project Interpreter”. Click on the “Dotted button” in the top-right corner and then “Add”.
Click on the “SSH Interpreter” radio-button and input your information.
The remote interpreter can not execute a local file, PyCharm have to copy your source files (your project) to a destination folder on your remote server, but this will be done automatically and you don’t need to think about it! While still in the “Preferences” pane, open “Build, Execution, Deployment > Deployment > Options”. Make sure that “Create empty directories” is checked. This way PyCharm will automatically synchronize when you create folders:
Now go back to “Build, Execution, Deployment > Deployment” and click on the “Plus button”, select “SFTP” and give a name to your remote. Click on “OK”:
Set up the connection by first typing the IP and password of your remote in “SFTP host”. You may then click on “Test SFTP connection”. Given that you can successfully connect you should set up mappings. If you’d like you can click on “Autodetect” beside the “Root path”, it will then find the place of your home directory on the remote. All paths you specify after this will be relative to this home path. Then go to the “Mappings” tab.
As soon as you save or create a file in your local path, it will be copied to the “Deployment path” on your remote server. Perhaps you want to deploy it in a DeployedProjects/ folder as shown below. This will be relative to your “Root path” specified earlier, so the absolute deployment path will in our case be be
Now we are finished with the preferences, click on “Apply” > “OK”, and then click “Tools > Deployment > Automatic Upload” and confirm that it is checked:
To do the initial upload, right-click on you project folder in the project explorer and click on “Upload to remote”: