I had hard time to setup remote debugging using PyCharm. One of the reason is lack of documentation about exact steps to setup the remote debugging.
I recently successfully setup remote debugging in pycharm. So these steps should work if you are trying to do the same.
- I am assuming that you have PyCharm with Licenses version install
- You have remote dev machine which you can ssh
- Let’s get into the exact steps to setup it.
- Go to Preferences -> Build, Execution, Deployment -> Deployment
- Select Add Server and setup using SFTP with follwoing values
- Setup project interpreter by providing remote interpreter location. You can also click on settings(icon) and select your dev env setup above. It should automatically setup for you.
- Now you just need to configure the deployment of your system as below:
- This will automatically transfer files for you on dev env(remote ssh steup above)
- Override the files as git does. So it almost works really smooth.
- Next step to install the pydev on your system as: pip install pydevd
- Do same pip installation on your remove dev.
- Now add these lines in your setting_local.py or settings.py.
- import pydevd; pydevd.settrace(‘172.17.17.134’, port=21000, suspend=False
- To get the ip address run this command: ifconfig (mac) and ipconfig(linux)
- replace this IP address <inet> in code to the above command (settrace)
- Sync this file with dev machine or it will automatically sync if you have done the first two steps. Now reload django.
- Now click on debug to start debugging.
Hope this will help to setup the remote debugging on your system.