Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Django Debug Toolbar work with DRF?

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?

like image 819
planetp Avatar asked Apr 16 '18 16:04

planetp


People also ask

Why does Django not show debug toolbar?

The Debug Toolbar is shown only if your IP address is listed in Django's INTERNAL_IPS setting. This means that for local development, you must add "127.0. 0.1" to INTERNAL_IPS .

What does debug do in Django?

One of the main features of debug mode is the display of detailed error pages. If your app raises an exception when DEBUG is True, Django will display a detailed traceback, including a lot of metadata about your environment, such as all the currently defined Django settings (from settings.py).


2 Answers

Didn't work for me until I've added

DEBUG_TOOLBAR_CONFIG = {
    "SHOW_TOOLBAR_CALLBACK": lambda request: True,
}
like image 189
Bojan Bogdanovic Avatar answered Sep 18 '22 06:09

Bojan Bogdanovic


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.

like image 36
ralfzen Avatar answered Sep 21 '22 06:09

ralfzen