Search code examples
djangodebuggingremote-debuggingpdbdjango-dev-server

Django - use pdb interactive debug for wsgi running app


If I develop a Django app and use the included testing server, I can just add a import pdb; pdb.set_trace() anywhere in the code and have a breaking point that throws me into an interactive debugger. To make things clear, I dont' mean using any IDE, just simple setup of ssh-ing into a VM or remote dev server.

How can I get a similar behavior for an WSGI Django app? (again, the assumed setup is me with an ssh session to the server - VM or remote)


Solution

  • To the best my knowledge, if you want to use pdb with arbitrary a wsgi app, your best bet is to use rpdb2.

    (for Django on mod_wsgi with apache, you can refer to this guide: http://code.google.com/p/modwsgi/wiki/DebuggingTechniques)