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?
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:
This one stops the debugger
Then I added 1 more breakpoint and voila. Debugger stops now.
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…
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.
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.