Debugging django

Simply put

import pdb; pdb.set_trace()

into a file named 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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: