Yos Riady optimize for learning

Effective Django Debugging with runserver_plus

Django Extensions is a collection of custom extensions for the Django Framework. These include management commands, additional database field, admin extensions and much more. One command that I’d like to highlight in this post is runserver_plus, which makes debugging a lot simpler when you’re trying to figure out what in the world is wrong in your code.

Let’s try it out in our command line:

pip install django-extensions
pip install ipython ipdb
pip install Werkzeug
./manage.py runserver_plus settings.py

In your settings.py:


First, you will need to install IPython, ipdb, Werkzeug, and django_extensions. You should then add django_extensions to your INSTALLED_APPS in your settings.py. Now that you have everything installed, you can use additional management commands such as shell_plus and runserver_plus.

Let’s take a look of this in the browser. There’s a normal series of errors, but the color schemes are different. Notice that there is an icon terminal in the error snippet. Clicking it opens a prompt and you can start typing.

Django Debugger Console

Basically, you have a console in your browser, which makes basic requests to the command line and returns the result. Think of this as an ipdb breakpoint and each of these points of the code.

Django Debugger Console

This is very powerful because it can make debugging a lot simpler, instead of having to manually put import ipdb; ipdb.set_trace().

Happy debugging!


You should follow him on Twitter.

📬 Get updates straight to your inbox!

Subscribe to my newsletter to make sure you don't miss anything.

Here's something you might be interested in...

Going Serverless book

Have you heard about the Serverless programming model? The Going Serverless book teaches you how to build scalable applications with the Serverless framework and AWS Lambda. You'll learn how to design, develop, test, deploy, and secure Serverless applications from planning to production.

Learn more →