Nicole Marie
Nicole Marie

Reputation: 159

Can someone explain debugging / Pycharm's debugger in an easy to understand way?

I have reached the stage in developing my Django project where I need to start debugging my code, as my site is breaking and I don't know why. I'm using Pycharm's IDE to code, and the debugger that comes with it is super intimidating!

Maybe because I am a total newbie to programming (been coding only since May) but I don't really understand how debugging, as a basic concept, works. I've read the Pycharm docs about debugging, but I'm still confused. What is the debugger supposed to do/how is it supposed to interact with your program? What helpful info about the code is debugging supposed to offer?

When I previously thought about debugging I imagined that it would be a way of running through the code line by line, say, and finding out "my program is breaking at this line of code," but "stepping through my code" seems to take me into files that aren't even part of my project (e.g. stepping into my code in admin.py will take me into the middle of a function in widgets.py?) etc. and seems to present lots of extra/confusing info. How do I use debugging productively? How can I use it to debug my Django webapp?

Please help! TIA :)

Upvotes: 0

Views: 143

Answers (2)

Reza Tanzifi
Reza Tanzifi

Reputation: 622

It's really easy. You can debug your script by pressing Alt+F5 or the bug button in Pycharm IDE. After that the Debugger handle the execution of the script. now you can debugging line by line by F10, get into a function or other object by pressing F11. Also there is Watch Window where you can trace your variable values while debugging. I really encourage you to search blogs on internet. There are lots of tutorial in this area

Upvotes: 1

Jorge Vidinha
Jorge Vidinha

Reputation: 434

A can leave you some links i found useful when i got to that same point - i cant get you a more comprehensive explanation on the topic than this materials do. Debugging is fundamental as you said and very broad. But this videos and links should get you start with more confidence.

https://www.youtube.com/watch?v=U5Zi2HDb2Dk 
https://www.youtube.com/watch?v=BBPoInSOiOY
https://www.youtube.com/watch?v=QJtWxm12Eo0
http://pedrokroger.net/python-debugger/

https://waterprogramming.wordpress.com/2016/04/08/debugging-in-python-using-pycharm-part-1/ https://waterprogramming.wordpress.com/2016/04/08/debugging-in-python-using-pycharm-part-2/ https://waterprogramming.wordpress.com/2016/04/08/debugging-in-python-using-pycharm-part-3/

Hope that helps

Upvotes: 1

Related Questions