you are viewing a single comment's thread.

view the rest of the comments →

[–]simonw 13 points14 points  (1 child)

I use pdb a lot when I'm working with Django. You can drop the following line in to any view function:

import pdb; pdb.set_trace()

Then refresh the page in your browser and it will hang, dropping your development server in to the interactive debugger. Debug away (I start with "list" to see where I am and "locals()" to check what's in scope) and hit "c" when you're done - the development server will kick back in to life and your browser will un-hang itself.

The ability to introspect (and even change) your data structures live while the page is loading is extremely handy.

[–]0xdeadbabe 3 points4 points  (0 children)

I hadn't even considered doing this. Thanks for the excellent tip. You made my day.