Debugging django

Simply put

import pdb; pdb.set_trace()

into a file named debug.py somewhere in your path. Then anywhere in your django app you just put

import debug

and when you run that webpage it will seem to take a really long time. Just switch to the console and you will have a python debugger open. I usually just type normal python commands print variable, dir(object) but it also support commands like gdb. c for continue running, n for next line, etc…

Thanks to debugging django for this tip.

Posted on 20 June 2009 by Paul Tarjan

If you liked this, you might also like...