Coding / Programming Videos

Post your favorite coding videos and share them with others!

Django Debug Toolbar Setup – Mahmud Al Hasan – Medium

Source link

This article will help you implement Django Debug Toolbar in your web application.

What is Django Debug Toolbar?

The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/response and when clicked, display more details about the panel’s content.

How to install and implement Django Debug Toolbar?

For the installation of the Django Debug Toolbar, you need to have a Django project where you can use pip in a Virtual Environment or without them. If you don’t want to use pip, you can get the code of this component from here ( and put it in your Django project path; but the pip installation is easier and I will focus on that.

For installation I recommend using the virtual env and executing this command:

$ pip install django-debug-toolbar

The configuration of this component is simple, you just need to change your project’s and to use the toolbar.

In your project’s, enter this code:

from django.conf import settings
from django.urls import include, path # For django versions from 2.0 and up
import debug_toolbar
urlpatterns = [
path('__debug__/', include(debug_toolbar.urls)),


Take care of the imports because it is possible that you may duplicate some of this.

Now In your project’s, make sure that debug mode is true.

DEBUG = True

Add debug_toolbar and make sure django.contrib.staticfiles exists in INSTALLED_APPS.


Add this line to MIDDLEWARE


Add INTERNAL_IPS in; The INTERNAL_IPS conf is valid for a local development environment, if your dev environment is different, you just change this field with your valid configuration.

INTERNAL_IPS = ('', '', 'localhost',)



You did it!

This is the default configuration and if you want to see more options, you can see this page:

Note: It is very important that you have the close body tag ( ) in your base template for the Django Debug Toolbar is showing.

This component has a variety of panels that can be added through the configuration. These panels show different information related to HTTP requests/responses and other relevant debug data. In this URL, you can see all different default panels and you can learn how to use and configure it.

Source link


Leave a Reply

Please Login to comment
Notify of
Translate »