Debugging Python code in a browser with wdb debugger
wdb is a nice Python debugger running as a server and capable of launching debug session in your browser. It can handle simple scripts, web apps (Tornado, Flask or Django based and alike) as well as other multithread and multiprocess programs. It's easy to use and not much configuration is required.
On the right side we have the stacktrace, on the left the debugged Python code, and below it - an interactive Python console. Aside of Python code it also supports debugger commands, like .s will tell the debugger to move to next break-point (or next line in this case).
Debugging Django or other applications you will want to use breakpoints - a places in code at which execution should stop launching the debug session. To create them for wdb just import it and then place in the code:
from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
from wdb.ext import WdbMiddleware application = WdbMiddleware(application)
DEBUG = True DEBUG_PROPAGATE_EXCEPTIONS = True
There are IDEs like PyCharm that have their own debuggers. They offer similar or equal set of features. You also don't have to modify the code to set breakpoints or to start debugging. However to use them you have to use those specific IDEs (and some of then are non-free or may not be available for all platforms). Pick the right tool for your needs.