Remote Debug Python Django app?
Answered
The remote debugging page (https://www.jetbrains.com/help/idea/remote-debugging.html) implies I must write code to get remote debugging to work. I would like to remote-debug a Django app, so I do not think that is an option.
I would like to execute the `pydev.py` file remotely, much like how it is done locally:
C:\Python37\python.exe C:\Users\kyle\.IntelliJIdea2019.2\config\plugins\python\helpers\pydev\pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 52454 --file manage.py runserver 0.0.0.0:8000
How do I install pydevd-pycharm.egg? What is the command line to execute it on the remote machine (actually a docker image)?
Thank you
Please sign in to leave a comment.
I can get the two to "connect" (for a moment), but then I reach code that is wrong. This happens locally (as seen below) and on the docker image.
After inspecting some of the codepaths in the PyDev.Debugger project, this seems to work better:
but there are import problems (which may be some interference between the remote debugger and the tricks inside django)
Hi, I am sorry for the late response.
> I must write code to get remote debugging to work
Do you mean inserting pydevd.settrace call in the source code? What exactly is blocking this approach?
>I would like to execute the `pydev.py` file remotely, much like how it is done locally:
Why not using a remote interpreter over SSH? PyCharm will basically call the same local command but on the remote machine once the remote interpreter is set as a project one. Sounds like exactly what you are looking for.
To clarify how the debugger is working under the hood:
As you may see "Python Remote Debug" has a specific role and should not be generally used for other cases. Native support for debugging code over SSH is much more convenient for remote debugging.
We'll change the "Python Remote Debug" run configuration name to remove the obvious confusion in 2020 release, see PY-39230.
In the meantime, the doc page you are referring to is quite outdated, I created a ticket for our technical writer to update it PY-39906. In the meantime please check an up-to-date version here https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html#remote-debug-config Python plugin for IntelliJ IDEA and PyCharm shares pretty much the same code (except minor UI difference).
PS Don't forget to remove pydevd. For "Python Remote Debug" pydevd-pycharm should be used instead and remote debugging over SSH doesn't require it in the first place. Having pydevd installed will only introduce compatibility issues as PyCharm is using a special patched version.
Sorry for a wall of text, hope it makes sense.
Please feel free to ask any relevant questions here or drop me a message directly at pavel.karateev@jetbrains.com