The other day, I read about another interesting way of debugging Django Apps:
If you use the following statement in you code:
import pdb; pdb.set_trace()
You can debug you app by running the server with the python command
manage.py runserver -p 8888
Then, after you visit the page where the set_trace() function is called, the server will break the code execution. If you then go to your terminal window, it will show you a prompt, at which you can go throught your code and variables.
Pretty good stuff!!
I’m looking for a solution to this problem http://groups.google.com/group/django-users/browse_frm/thread/af9073d32f1221a
I am able to add set_trace() in my code, but I don’t know how to step through the code to get to the exception and then trigger the shell. I need to see what file is causing the failed import.
If you could expand a bit on your post and give an example of how you might debug an import statement in a template exception that would help me a bit. possibly help some others since set_trace() seems quite useful. if I figure this out I will also try to write a post about it.
Ah great, i see you already found a solution!
I have found that the easiest way to debug Django apps is to just run mange.py inside of Eclipse. With Eclipse and PyDev, you have all of the features of a good debugger. This has saved me a huge amount of time for my projects.
Cheers!
-Josh