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 you 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 defines whether the toolbar will attempt to automatically adjust your project’s settings, as described in the installation instructions. By default it has the same value as your DEBUG setting.


This setting specifies the full Python path to each panel that you want included in the toolbar. It works like Django’s MIDDLEWARE_CLASSES 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


    Default: '</body>'

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


    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 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.


    Default: 10

    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, the IP of the request must be in INTERNAL_IPS, and the request must no be an AJAX request. You can provide your own function that accepts a request in argument and returns True or False.

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: ('socketserver', 'threading', 'wsgiref', 'debug_toolbar', 'django'). The first value is socketserver on Python 3 and SocketServer on Python 2.

    Panels: cache, SQL

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


    Default: False

    Panel: redirects

    If set to True, the redirect panel will be active by default.


    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 datastructures that you don’t want to be evaluated.


    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
Read the Docs v: 1.0
On Read the Docs
Project Home

Free document hosting provided by Read the Docs.