A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://django-debug-toolbar.readthedocs.io/en/latest/configuration.html below:

Website Navigation


Configuration — Django Debug Toolbar 6.0.0 documentation

Configuration

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

Note

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.

DEBUG_TOOLBAR_PANELS

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:

DEBUG_TOOLBAR_PANELS = [
    'debug_toolbar.panels.history.HistoryPanel',
    'debug_toolbar.panels.versions.VersionsPanel',
    'debug_toolbar.panels.timer.TimerPanel',
    'debug_toolbar.panels.settings.SettingsPanel',
    'debug_toolbar.panels.headers.HeadersPanel',
    'debug_toolbar.panels.request.RequestPanel',
    'debug_toolbar.panels.sql.SQLPanel',
    'debug_toolbar.panels.staticfiles.StaticFilesPanel',
    'debug_toolbar.panels.templates.TemplatesPanel',
    'debug_toolbar.panels.alerts.AlertsPanel',
    'debug_toolbar.panels.cache.CachePanel',
    'debug_toolbar.panels.signals.SignalsPanel',
    'debug_toolbar.panels.redirects.RedirectsPanel',
    'debug_toolbar.panels.profiling.ProfilingPanel',
]

This setting allows you to:

DEBUG_TOOLBAR_CONFIG

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

Toolbar options Panel options

Caution

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.

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

# This example is unlikely to be appropriate for your project.
DEBUG_TOOLBAR_CONFIG = {
    # Toolbar options
    'RESULTS_CACHE_SIZE': 3,
    'SHOW_COLLAPSED': True,
    # Panel options
    'SQL_WARNING_THRESHOLD': 100,   # milliseconds
}

Here’s an example of using a persistent store to keep debug data between server restarts:

DEBUG_TOOLBAR_CONFIG = {
    'TOOLBAR_STORE_CLASS': 'debug_toolbar.store.DatabaseStore',
    'RESULTS_CACHE_SIZE': 100,  # Store up to 100 requests
}
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 }}
<style>
    :root {
        --djdt-font-family-primary: 'Roboto', sans-serif;
    }
</style>
{% endblock %}

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4