Remote Debugging Using PyCharm

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.

Presumption:

  • I am assuming that you have PyCharm with Licenses version install
  • You have remote dev machine which you can ssh

Steps:

    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

 

remote_debugging_setup_1.png

 

 

  • 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.

interpretor

  • 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.

configuration_deployment

  • 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)image_ifconfig
  • 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.debug-pycharm

 

If you want to have full setup of PyCharm, you can read this post: https://softwareautotools.com/2017/11/17/my-development-setup-django-javascript/

Hope this will help to setup the remote debugging on your system.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: