Created Remote Debugging (markdown)
parent
1390e2b5ff
commit
12384863a7
1 changed files with 20 additions and 0 deletions
20
Remote-Debugging.md
Normal file
20
Remote-Debugging.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
In PyCharm create a `Python Remote Debugging` run configuration, it provides some instructions on what to do next. Here is a more detailed version of the next steps:
|
||||
|
||||
1. Upload `pycharm-debug.egg` from `$PYCHARM_INSTALL_DIR/debug-eggs/pycharm-debug.egg` up to the server.
|
||||
1. Modify the source you want to debug by adding code for connecting to the debug server:
|
||||
```
|
||||
import sys
|
||||
sys.path.append('/PATH/TO/pycharm-debug.egg')
|
||||
import pydevd
|
||||
pydevd.settrace('localhost', port=1984)
|
||||
```
|
||||
You can put this code anywhere in the project. It will act as the initial breakpoint and upon hitting this
|
||||
breakpoint it will try to connect to the debug server so that you can either continue stepping through code
|
||||
or continue the execution.
|
||||
1. In order for the app to be able to connect to your local PyCharm instance you need to setup an ssh tunnel; you do this from your local machine. Map the port in the code above (eg, `1984`) to go into a tunnel and connect on the local port that the debugger is listening on (eg, `8000`):
|
||||
```
|
||||
ssh -R 1984:localhost:8000 lbry@54.236.53.10
|
||||
```
|
||||
1. Last thing to do before debugging is to map the source directories between what they are on your local machine and on the remote server. This is so that as the debugger is stepping through the code you can actually see the code. You do this in the `Python Remote Debug` configuration in the `Path mappings` section.
|
||||
1. Set the port you want the debugger to listen on (eg, `8000`).
|
||||
1. Once everything is setup and ready to go you want to start the debug server in PyCharm then after it's ready and listening for connections you can start the app on the server. Then just wait for the app to connect to PyCharm.
|
Loading…
Add table
Reference in a new issue