I'm trying to setup Debug Toolbar to debug some API methods via DRF's Browsable API. I've went through the steps described on the Installation page (like updating INSTALLED_APPS
, MIDDLEWARE
, etc.) but still can't see any toolbar. So does Debug Toolbar work with DRF? How to debug the issue with it not showing up?
Asked
Active
Viewed 1.6k times
24

planetp
- 14,248
- 20
- 86
- 160
-
I also found a way to use it with DRF AJAX requests by using https://github.com/djsutho/django-debug-toolbar-request-history which will store all recent requests so that can be accessed later from the Debug Toolbar interface. You can use your app, make requests, then go view the profiles! The Debug Toolbar project is integrating this directly into the project soon: https://github.com/jazzband/django-debug-toolbar/pull/1250 – CraigTeegarden Apr 22 '20 at 13:21
3 Answers
29
Didn't work for me until I've added
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": lambda request: True,
}

Bojan Bogdanovic
- 500
- 1
- 6
- 6
-
Just note that this will bypass the INTERNAL_IPS & DEBUG checks - https://django-debug-toolbar.readthedocs.io/en/latest/configuration.html#show-toolbar-callback – John Carter Nov 27 '22 at 22:15
-
It's not recommended, because it will show the debug tool in production mode. by default, it will be shown only when debug is true – Hamed Damirchi Aug 13 '23 at 14:46
14
Yes, it works fine if you have the correct INTERNAL_IPS = [..]
. With docker you also have to find out the IP of serving proxy-server for example nginx
-container.

ralfzen
- 327
- 3
- 8
10
Yes, Debug Toolbar works with DRF, but you need also to add INTERNAL_IPS = ['127.0.0.1',]
to your settings.py
file.

cezar
- 11,616
- 6
- 48
- 84

neverwalkaloner
- 46,181
- 7
- 92
- 100
-
1Make sure you put the right ip-address to `INTERNAL_IPS` if you use a reverse proxy. – planetp Apr 21 '18 at 13:03