Debugging Django on Windows : Developement Setup

Django I remember the days when I used to struggle while debugging django web applications. But after working for more than a year now with django, I am more or less settled with tools I use for debugging Django Application. My Development System is on Windows XP, so this post is specifically for Debugging django on windows.

Debugging Django on Windows XP

The best tool I found on Windows environment for Django/ Python Debugging is : WinPDB, Just download and install.

Steps to Debug a application

Launch WinPDB

You’ll find following screen after opening WinPDB.

Start App in WinPDB

Launch an the application using File -> Launch. If For e.g. my application is in C:\projectHome\manage.py
I will write launch application as:

C:\projectHome\manage.py runserver --noreload

Click on “GO” button on top toolbar.

Put BreakPoints

Open the affected file(file which needs debugging e.g. views.py), File->Open Source. Now put breakpoint in the source code by pressing F9. You are all set for debugging. Isn’t that simple.
Now go to browser and hit the URL which is causing problem. The debugger will stop execution on breakpoint.

Now What

Now you are free to do anything for debugging, you can go for step execution if you think there is some error in login/code. You can also see inmemory objects. etc, etc.





For me WinPDB has solved everything, hope it will help you as well.

One Response

Leave a Reply