Some time ago, while researching about Flask we came across the Werkzeug project and we noticed one very special feature, the interactive debugger
It’s been a while since we started using Docker containers on our development environments. One small consequence of this is that interactive consoles are not as easily accessible as before while running a whole application.
This is usually fine, except for some specifics, such as debugging Python code. Most debuggers are available only at the executing console.
We decided to try to enable the Werkzeug debugger for our Django projects. While on this, we discovered that this has been previously undertaken by the django-extensions project. Nevertheless, some problems arised while trying to use it:
Given this two issues, and after careful inspection of the Werkzeug code, we decided to create a standalone management command
rundbg that provides solves both of this issues.
You can run it either for API development, as well as regular Django templates.
To use it, just install it with pip and switch from
rundbg. If you are working on APIs add the
If you place an
assert False in your code at some point, when hitting a View that executes this it will show you something like:
Following the link it will lead you to the interactive debugger.
More information, including installation and configuration guides available at the GitHub repo.