Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening remote project in PyCharm

I'm working on a project that is located in a remote server. Can I open it in PyCharm from my local machine ? I couldn't find the way.

like image 620
kbrk Avatar asked Jul 30 '15 11:07

kbrk


People also ask

How do I connect to a remote server in PyCharm?

Connect to a remote server and open the remote project Ensure you have the Remote Development Gateway plugin enabled. On the PyCharm welcome screen, select Remote Development. In the Run the IDE Remotely section, click Connect via SSH.

Does PyCharm Community Edition support remote development?

Remote development is not currently available in the Community and Educational versions of IntelliJ IDEA and PyCharm.


2 Answers

The way I access the projects on my raspberry pi using PyCharm is the following (This expects you to be using PyCharm Pro, supporting SSH connections):

  1. Mount the home folder on my local machine ( I use SFTP Drive on windows, under Linux use sshfs).
  2. Open the project from the mounted drive in PyCharm
  3. Go to Settings -> Project -> Project Interpreter and select the gear next to the Project Interpreter drop down. From there pick "Add Remote".
  4. Configure the remote interpreter you want to use.

If the PyCharm project was already created on the server, I guess your run configuration should be in order and running it should work out of the box.

If you created the PyCharm project on your local machine:

  • If you have no run configuration yet, go to the file you want to run and do right-click -> Run yourfilename.py or simply hit Shift-F10
  • The remote interpreter will complain about non existent files. Go to the dropdown in the top right corner, click it and select 'Edit Configurations'
  • Change the script path and working directory to the actual remote directories. Remember, this is what your interpreter sees, and your interpreter is on your remote machine.

Hope this helps!

like image 77
Skusku Avatar answered Sep 21 '22 00:09

Skusku


To update on excellent @Skusku answer given here: https://stackoverflow.com/a/47614111/2119941

After mounting remote folder with SFTP Drive if Pycharm project browser doesn't recognize remote drive just copy-paste it in location bar on top and allow Pycharm to load it:

enter image description here

And when you load your project files to Pycharm you need to add remote interpreter which is present on your server:

enter image description here

In following screens just add host, credentials and than path to python in virtual env or whatever python is running your server project files.

like image 20
Hrvoje Avatar answered Sep 21 '22 00:09

Hrvoje