Integrating the Werkzeug web based debugger with Django (with APIs in mind)

35 views
Skip to first unread message

Juan Saavedra

unread,
Apr 7, 2017, 10:27:55 AM4/7/17
to Django REST framework
Hello,

We created a small management command to run a tweaked version of the Werkzeug dev server and debugger in Django. A small intro and description is available at https://www.octobot.io/blog/django-rundbg-release/

I've come to share this here, since we use regularly DRF and this tool is particularly useful for debugging APIs.

PRs and Issue reports are welcome at https://github.com/octobot-dev/django-rundbg

We hope you find it as useful as we do,
Regards.

Tom Christie

unread,
May 1, 2017, 7:33:15 AM5/1/17
to Django REST framework
Very nice! I've come to appreciate just how great Werkzeug really is, and the interactive debugger is certainly a nice feature to have available in Django.

One question based on this from the credits...

> The Django Extensions runserver_plus is a more comprehensive command than this one.

What's the difference with this versus the runserver plus version?

Juan Saavedra

unread,
May 2, 2017, 9:43:29 AM5/2/17
to Django REST framework
Thanks! The main difference is the ability to access an exception thread without actually triggering the error. This is very useful when testing APIs with tools such as cURL and it was the reason why we developed it.

In the Werkzeug debugger and in runserver_plus whenever an unhandled exception is raised, it returns an error page with the interactive debugger. This is a problem if you are using a terminal or even tools such as Postman/Chrome Dev Console.

With rundbg we added an --use-link option that will return a link to the interactive debugger instance with the stack frames for that exception. Therefore, in case of an error you can access the interactive debugger in a browser window regardless of where you triggered the exception.

An example for this is available at the project home.

Regards.

Tom Christie

unread,
May 2, 2017, 3:51:28 PM5/2/17
to Django REST framework
Thanks for clarifying - neat idea!
Reply all
Reply to author
Forward
0 new messages