| 4 | |
| 5 | [[BR]] |
| 6 | |
| 7 | Fors instance, to debug a view you'd:[[BR]] |
| 8 | |
| 9 | 1) Add "import rpdb2" in the begining of your app's views.py[[BR]] |
| 10 | |
| 11 | 2) Add "rpdb2.start_embedded_debugger("any_password")" in your certain view, on the line which one you want to debug.[[BR]] |
| 12 | |
| 13 | 4) Launch embedded django webserver: $"python manage.py runserver --noreload"[[BR]] |
| 14 | |
| 15 | 5) Launch winpdb: $"winpdb"[[BR]] |
| 16 | |
| 17 | 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.[[BR]] |
| 18 | |
| 19 | 6) Get back to Winpdb window. Choose file->Attach.[[BR]] |
| 20 | |
| 21 | 7) Enter "any_password", click "Ok".[[BR]] |
| 22 | |
| 23 | 8) Click on the Line in the List View, below PID FILENAME similar to "12789 /home/user/django_project/django_app...". Click OK.[[BR]] |
| 24 | |
| 25 | 9) An error message "Warning: You attached to an embedded debuger" should appear. click cancel.[[BR]] |
| 26 | |
| 27 | 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!:)[[BR]] |
| 28 | |
| 29 | |