Simple Guide To Django Debug Toolbar

Ranjan MP
2 min readOct 5, 2020

If you’d ask me, Is Django Debug Toolbar a good tool to have during development?, I’d say, you’re wasting your time thinking that, just close your eyes and ‘pip install django-debug-toolbar’.
I’m not even gonna try to give you the advantages of it, because once you start using it, you’ll know.

The moment you click the DebugToolbarHandle icon, your mind will be blown

So Let me help you to Install and Configure it.

$ pip install django-debug-toolbar

In your settings.py add

if DEBUG:
INSTALLED_APPS += ['debug_toolbar',]
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware',]
INTERNAL_IPS = [
'127.0.0.1',
]

If the Django Development server is hosted on cloud, you need to add your ip address to the INTERNAL_IPS setting else you’ll not be able to see the Django Debug Toolbar. Simple way to get your ip address is to search google for ‘whatsmyip’.

In your urls.py present in you project directory add

from django.conf import settings
if settings.DEBUG:
import debug_toolbar
urlpatterns += [
path('__debug__/', include(debug_toolbar.urls)),
]

Thats is!! Happy Developing

Couple of points more 😬

Make sure you use Django Debug Toolbar only in development environment that is if DEBUG = True.

Django Debug Toolbar works with DRF as well, you can visit the api endpoint on the browser and find the DebugToolbarHandle Icon.

--

--