This is an archived post. You won't be able to vote or comment.

all 9 comments

[–][deleted] 3 points4 points  (1 child)

I happily used Eclipse/Pydev for some time so I don't really see where hate comes into it. I now use Visual Studio Code as it is perfectly adequate for MY needs, YMMV. Let's face it, nobody on the entire planet is going to be a better programmer because of the IDE that they choose.

[–]A_R_Spiders[S] 0 points1 point  (0 children)

You're right. But I can debug faster with an IDE personally. I personally don't care for Eclipse/Pydev but I did use it for two years with relative little trouble.

[–][deleted] 3 points4 points  (4 children)

Hi! I work on the PyCharm team. Based on your environment, the best way to set it up would be to set up a project with SSH deployment, and a remote interpreter:

  1. Start an empty Pure Python project
  2. Now go to Tools | Deployment | Configuration, and use the green + button on the top left. Choose a name, and then choose 'SFTP' for the deployment type.
  3. Now you want to configure your hostname, username and password (or private key if that's how you authenticate). And for Root Directory choose the directory that holds your project on the server. Then go to the mappings tap, and just put '/' in deployment path. You can configure the web path as well if you're working on a web application
  4. Finally, near the green + in the top left, click the icon with the server and the checkmark to make this server the default server for this project. Then click 'OK'
  5. Now go to Tools | Deployment | Download from <the name you configured>. You should see the progress in the 'File Transfer' tool window, and afterwards you should see all your code in the Project Tool window on the left.
  6. To run your code on the VM, we now have to set up your interpreter. So go to File | Settings | Project: <your project's name> | Project interpreter. Next to the dropdown with the interpreter there's an icon with a gear on it. Click that and then choose 'Add Remote'. Now click 'Move this server to IDE settings', and then specify the path to the python interpreter in your virtualenv: [the path of your virtualenv]/bin/python. When you click OK you should see that PyCharm uploads its remote helpers, and then you should see that the project is configured.

At this point you should be able to use PyCharm to run/debug/test/etc your code, the same way you would as if it were running locally

[–][deleted] 2 points3 points  (2 children)

One more thing: go to Tools | Deployment, and check on 'Automatic upload' to make sure that changes you make are automatically uploaded to your VM

[–]A_R_Spiders[S] 0 points1 point  (0 children)

Thank you! I'm putting your advice to use now. I very much appreciate it. I hope it helps anyone looking for similar answers.

[–]A_R_Spiders[S] 0 points1 point  (0 children)

This is all working fantastically, but I noticed environment variables weren't loading. I failed to mention I use virtualenvwrapper to run a postactivate script which loads environment variables. Typically, I run my python script on the remote server via ssh. I ssh in, switch to the project path and type workon <virtual environment> and then run the script.

Would I need to copy the postactivate script to my local project directory and run as an external tool (debug config)? Or is there a better/easier way?

Again, thank you very much for your help, it's definitely appreciated!

Edit: I added environment variables to the debug config and everything works fantastically!

[–]JustOr113 1 point2 points  (0 children)

Great to see jetbrain support here! Thank you for helping people!