Changes between Version 1 and Version 2 of DebuggingDjangoWithWinpdb


Ignore:
Timestamp:
10/29/09 12:54:27 (5 years ago)
Author:
tomas.cerkasas@…
Comment:

Added a step-by-step example of debugging a view.

Legend:

Unmodified
Added
Removed
Modified
  • DebuggingDjangoWithWinpdb

    v1 v2  
    1 Using Winpdb to debug Django apps is pretty stright forward. You can go to [http://www.digitalpeers.com/pythondebugger/?page_id=5 Winpdb Docs] to learn the basics of Winpdb.
     1Using Winpdb to debug Django apps is pretty straight forward. You can go to [http://www.digitalpeers.com/pythondebugger/?page_id=5 Winpdb Docs] to learn the basics of Winpdb.
    22
    33After learning Winpdb, make sure that you launch your django server with --noreload or your breakpoints won't work.
     4
     5[[BR]]
     6
     7Fors instance, to debug a view you'd:[[BR]]
     8
     91) Add "import rpdb2" in the begining of your app's views.py[[BR]]
     10
     112) Add "rpdb2.start_embedded_debugger("any_password")" in your certain view, on the line which one you want to debug.[[BR]]
     12
     134) Launch embedded django webserver: $"python manage.py runserver --noreload"[[BR]]
     14
     155) Launch winpdb: $"winpdb"[[BR]]
     16
     177) 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.[[BR]]
     18
     196) Get back to Winpdb window. Choose file->Attach.[[BR]]
     20
     217) Enter "any_password", click "Ok".[[BR]]
     22
     238) Click on the Line in the List View, below PID FILENAME similar to "12789 /home/user/django_project/django_app...". Click OK.[[BR]]
     24
     259) An error message "Warning: You attached to an embedded debuger" should appear. click cancel.[[BR]]
     26
     2710) 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!:)[[BR]]
     28
     29 
Back to Top