Reputation: 101
I am trying to debug django project with docker-compose interpreter.
Here is my pycharm configurations
But when I trying to debug it project still running but debugger is still waiting for connection and break point not working
I think that structure of my project have problem cause i'm try to debug other project it still working.
Here is my project structure
What am i doing wrong?
Upvotes: 10
Views: 5486
Reputation: 171
I had been experiencing this issue myself on and off for a while until I toggled off the 'Run Debugger in Server Mode' option for the PyCharm debugger in settings.
Upvotes: 17
Reputation: 1364
What helped for me was changing Debugger port. It's a temporary workaround, not a solution, but works for now.
Go to Settings > Build, Execution, Deployment > Python Debugger
. Or search settings for Debugger port
.
Default is 29781. When you get Waiting for connection...
, change port to any other (e.g. 29782) and run debugger again. When it stops working again, change it back to 29781. Repeat whenever needed.
Annoying and far from ideal solution, but other answers here didn't work for me. Seems like no other apps are using the port besides PyCharm itself.
Upvotes: 9
Reputation: 2354
To whomever else it might help, the problem in my case was that I attempted to use the debugger coupled with a run inside a Docker container functionality.
I also happened to have all ports published on that container which prevented the debugger to connect. Publishing only ports I actually needed, resolved the problem.
Upvotes: 1
Reputation: 201
Check the running ports on your machine. In my case, the port that PyCharm wanted to use for debugging (127.0.0.1:xxxx) was being used by another program on my laptop.
You can check the running ports using the following command on mac:
lsof -i -P | grep -i "listen"
Or, the following command once you know which port PyCharm is trying to use (usually you can see that on top of the console tab of PyCharm after starting debugging process):
sudo lsof -i :xxxxx
After running that, you should see a list with PID numbers, names of program etc. Then you can kill the running process on that port using the PID:
sudo kill -9 PID
Or, just restart your computer.
If that doesn't work, then it might be due to using already-existing Python module names. Make sure the names of the Python files in your project isn't the same as any other library/code from python.
Upvotes: 1