PyCharm – Django Debugger Won’t Stop At BreakPoints

Debugging a Django project in PyCharm is actually quite easy. All you need to do is add couple of breakpoints and hit that little debug button you see at the top right corner of the IDE. Now when you run your app, PyCharm’s Django debugger should stop at those breakpoints, right?

django-debug-button

Nope, not that straightforward.

Breakpoints that won’t stop the debugger

Check out the lines below for example. I first put breakpoints on these 2 lines but the debugger would not hit any of them:

invalid-breakpoints-pycharm-django

This one stops the debugger

Then I added 1 more breakpoint and voila. Debugger stops now.

valid-breakpoint-pycharm-django

Suspend

You see. Not all the breakpoints will make the debugger stop there. But why? Why did it not stop at my breakpoints? The answer was simple.

Click Run -> View Breakpoints…

run-viewbreakpoints-pycharm

Now I see the Breakpoints window. Clicking through my breakpoints I realise that for the ones that debugger won’t stop at, the Suspend checkbox is not selected.

django-breakpoints-window

Coming from other IDEs you might assume (like I did) that putting a breakpoint would by default mean that the debugger would stop there but for PyCharm 2016.21994 this is not the case. Your breakpoints not only need to be enabled but also need to be marked as Suspend.

Hope this helps.
Good Luck,
Serdar