The debug toolbar provides two settings that you can add in your project’s settings module to customize its behavior.


Do you really need a customized configuration?

The debug toolbar ships with a default configuration that is considered sane for the vast majority of Django projects. Don’t copy-paste blindly the default values shown below into your settings module! It’s useless and it’ll prevent you from taking advantage of better defaults that may be introduced in future releases.


This setting specifies the full Python path to each panel that you want included in the toolbar. It works like Django’s MIDDLEWARE setting. The default value is:


This setting allows you to:

  • add built-in panels that aren’t enabled by default,

  • add third-party panels,

  • remove built-in panels,

  • change the order of panels.


This dictionary contains all other configuration options. Some apply to the toolbar itself, others are specific to some panels.

Toolbar options




    This setting is a set of the full Python paths to each panel that you want disabled (but still displayed) by default.


    Default: '</body>'

    The toolbar searches for this string in the HTML and inserts itself just before.


    Default: "test" in sys.argv

    This setting whether the application is running tests. If this resolves to True, the toolbar will prevent you from running tests. This should only be changed if your test command doesn’t include test or if you wish to test your application with the toolbar configured. If you do wish to test your application with the toolbar configured, set this setting to False.


    Default: None

    If set to False, the debug toolbar will keep the contents of panels in memory on the server and load them on demand.

    If set to True, it will disable HistoryPanel and render panels inside every page. This may slow down page rendering but it’s required on multi-process servers, for example if you deploy the toolbar in production (which isn’t recommended).

    The default value of None tells the toolbar to automatically do the right thing depending on whether the WSGI container runs multiple processes. This setting allows you to force a different behavior if needed. If the WSGI container runs multiple processes, it will disable HistoryPanel.


    Default: 25

    The toolbar keeps up to this many results in memory.


    Default: ''

    This setting is injected in the root template div in order to avoid conflicts with client-side frameworks. For example, when using the debug toolbar with Angular.js, set this to 'ng-non-bindable' or 'class="ng-non-bindable"'.


    Default: False

    If changed to True, the toolbar will be collapsed by default.


    Default: 'debug_toolbar.middleware.show_toolbar'

    This is the dotted path to a function used for determining whether the toolbar should show or not. The default checks are that DEBUG must be set to True and the IP of the request must be in INTERNAL_IPS. You can provide your own function callback(request) which returns True or False.

    For versions < 1.8, the callback should also return False for AJAX requests. Since version 1.8, AJAX requests are checked in the middleware, not the callback. This allows reusing the callback to verify access to panel views requested via AJAX.


    Please note that the debug toolbar isn’t hardened for use in production environments or on public servers. You should be aware of the implications to the security of your servers when using your own callback. One known implication is that it is possible to execute arbitrary SQL through the SQL panel when the SECRET_KEY value is leaked somehow.


    Default: 'debug_toolbar.toolbar.observe_request'


    This setting is deprecated in favor of the UPDATE_ON_FETCH and SHOW_TOOLBAR_CALLBACK settings.

    This is the dotted path to a function used for determining whether the toolbar should update on AJAX requests or not. The default implementation always returns True.


    Default: None

    The language used to render the toolbar. If no value is supplied, then the application’s current language will be used. This setting can be used to render the toolbar in a different language than what the application is rendered in. For example, if you wish to use English for development, but want to render your application in French, you would set this to "en-us" and LANGUAGE_CODE to "fr".


    Default: False

    This controls whether the toolbar should update to the latest AJAX request when it occurs. This is especially useful when using htmx boosting or similar JavaScript techniques.


    Default: "auto"

    This controls which theme will use the toolbar by default.

Panel options


    Default: []

    Panel: signals

    A list of custom signals that might be in your project, defined as the Python path to the signal.


    Default: True

    Panels: cache, SQL

    If set to True, this will show stacktraces for SQL queries and cache calls. Enabling stacktraces can increase the CPU time used when executing queries.


    Default: False

    Panels: cache, SQL

    If set to True, this will show locals() for each stacktrace piece of code for SQL queries and cache calls. Enabling stacktraces locals will increase the CPU time used when executing queries and will give too verbose information in most cases, but is useful for debugging complex cases.


This will expose all members from each frame of the stacktrace. This can potentially expose sensitive or private information. It’s advised to only use this configuration locally.




    Panels: cache, SQL

    Useful for eliminating server-related entries which can result in enormous DOM structures and toolbar rendering delays.


    Default: True

    Panel: SQL

    Controls SQL token grouping.

    Token grouping allows pretty print of similar tokens, like aligned indentation for every selected field.

    When set to True, it might cause render slowdowns when a view make long SQL textual queries.

    Without grouping:

        "auth_user"."id", "auth_user"."password", "auth_user"."last_login",
        "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name",
    FROM "auth_user"
    WHERE "auth_user"."username" = '''test_username'''
    LIMIT 21

    With grouping:

    SELECT "auth_user"."id",
      FROM "auth_user"
    WHERE "auth_user"."username" = '''test_username'''
    LIMIT 21

    Default: True

    Panel: profiling

    When enabled this setting will include all project function calls in the panel. Project code is defined as files in the path defined at settings.BASE_DIR. If you install dependencies under settings.BASE_DIR in a directory other than sites-packages or dist-packages you may need to disable this setting.


    Default: 10

    Panel: profiling

    This setting affects the depth of function calls in the profiler’s analysis.


    Default: 8

    Panel: profiling

    This setting affects the which calls are included in the profile. A higher value will include more function calls. A lower value will result in a faster render of the profiling panel, but will exclude data.

    This value is used to determine the threshold of cumulative time to include the nested functions. The threshold is calculated by the root calls’ cumulative time divided by this ratio.


    Default: True

    Panel: templates

    If set to True then a template’s context will be included with it in the template debug panel. Turning this off is useful when you have large template contexts, or you have template contexts with lazy data structures that you don’t want to be evaluated.


    Default: ('django/forms/widgets/', 'admin/widgets/')

    Panel: templates.

    Templates starting with those strings are skipped when collecting rendered templates and contexts. Template-based form widgets are skipped by default because the panel HTML can easily grow to hundreds of megabytes with many form fields and many options.


    Default: 500

    Panel: SQL

    The SQL panel highlights queries that took more that this amount of time, in milliseconds, to execute.

Here’s what a slightly customized toolbar configuration might look like:

# This example is unlikely to be appropriate for your project.
    # Toolbar options
    # Panel options
    'SQL_WARNING_THRESHOLD': 100,   # milliseconds

Theming support

The debug toolbar uses CSS variables to define fonts and colors. This allows changing fonts and colors without having to override many individual CSS rules. For example, if you preferred Roboto instead of the default list of fonts you could add a debug_toolbar/base.html template override to your project:

{% extends 'debug_toolbar/base.html' %}

{% block css %}{{ block.super }}
    :root {
        --djdt-font-family-primary: 'Roboto', sans-serif;
{% endblock %}

The list of CSS variables are defined at debug_toolbar/static/debug_toolbar/css/toolbar.css