Version 2 (modified by 15 years ago) ( diff ) | ,
---|
Using Winpdb to debug Django apps is pretty straight forward. You can go to Winpdb Docs to learn the basics of Winpdb.
After learning Winpdb, make sure that you launch your django server with --noreload or your breakpoints won't work.
Fors instance, to debug a view you'd:
1) Add "import rpdb2" in the begining of your app's views.py
2) Add "rpdb2.start_embedded_debugger("any_password")" in your certain view, on the line which one you want to debug.
4) Launch embedded django webserver: $"python manage.py runserver --noreload"
5) Launch winpdb: $"winpdb"
7) In your web browser, go to the url which would trigger the view you want to debug. In the browser you'll see "Loading" and nothing else happening.
6) Get back to Winpdb window. Choose file->Attach.
7) Enter "any_password", click "Ok".
8) Click on the Line in the List View, below PID FILENAME similar to "12789 /home/user/django_project/django_app...". Click OK.
9) An error message "Warning: You attached to an embedded debuger" should appear. click cancel.
10) If what you see in WinPDB windows doesn't seem to make much sense(and even though it does!:) - http://winpdb.org/tutorial/WinpdbTutorial.html should be your next step. Happy debugging!:)