Skip to main content

django-devbar

A performance bar for Django development. Shows database query counts, query duration, and application time. Flags similar and duplicate queries.

Settings and the response header format remain compatible within 1.x. Breaking changes require a new major version.

Badge PyPI Badge Chrome Badge Firefox

Install

Component Install from Notes
Django package PyPI uv add --dev django-devbar
Chrome DevTools extension Chrome Web Store Optional
Firefox DevTools extension Firefox Add-ons Optional
Browser extension packages GitHub Releases Manual/dev installs and checksums

Screenshots

Query count, query duration, and application time:

devbar example

Similar and duplicate queries with details:

devbar warning example

The optional Chrome and Firefox extension shows query details in DevTools:

Browser DevTools extension

Motivation

django-devbar sends metrics in response headers and can display an HTML bar. Compared with Django Debug Toolbar:

  • Setup requires one middleware entry.
  • The browser extension reads metrics from any response type, including JSON.
  • Django is the only dependency.
  • Metrics require no extra requests to debug endpoints.
  • The HTML bar is optional. You can use headers and the extension alone.

Django setup

# Using uv
uv add --dev django-devbar

# Or using pip
pip install django-devbar

Place DevBar near the start of your middleware list:

MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    # ...
]

if DEBUG:
    idx = MIDDLEWARE.index("django.middleware.security.SecurityMiddleware")
    MIDDLEWARE.insert(idx + 1, "django_devbar.DevBarMiddleware")

The if DEBUG condition keeps the middleware active only in development. It also avoids import errors when the package is not installed in production.

If the middleware remains installed, DEBUG=False disables the HTML bar and detailed DevBar-Data header by default, but query collection and Server-Timing remain active. Use the conditional setup above to disable collection in production.

Configuration

All settings are optional. Set them in a DEVBAR dictionary in your Django settings:

DEVBAR = {
    "POSITION": "bottom-right",  # bottom-right (default), bottom-left, top-right, top-left
    "SHOW_BAR": None,  # follows DEBUG; set True/False to override
    "ENABLE_DEVTOOLS_DATA": None,  # follows DEBUG; set True/False to override
    "DEVTOOLS_HEADER_MAX_BYTES": 6144,  # max bytes for DevBar-Data header payload
    "DEVTOOLS_MAX_QUERIES": None,  # optional cap for query entries sent to DevTools
}

Header limits reduce data sent to DevTools, not query collection or its memory use.

Response headers

DevBar always adds Server-Timing with database, application, and total time. You can view it in the browser's Network tab under Timing:

Server-Timing: db;dur=87.50, app;dur=41.30, total;dur=128.80

Timings and query counts exclude streaming body generation and queries executed while a streaming response is consumed.

With DEBUG=True, DevBar also adds a DevBar-Data JSON header by default:

  • The q entries contain query details, with dup and sim flags for duplicate and similar queries.
  • The payload is truncated to fit DEVTOOLS_HEADER_MAX_BYTES.
  • Truncated payloads include tr, q_total, and q_sent metadata.

Use these headers to inspect API responses, read metrics in the browser extension, or check query counts in automated tests.

Browser extension

Install the extension from Chrome Web Store or Firefox Add-ons to view metrics in DevTools.

See browser-extension/README.md for more details.

Metadata

Release files for django-devbar 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-devbar 1.0.0
File Size Uploaded Provenance
django_devbar-1.0.0.tar.gz 10.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-devbar 1.0.0
File Interpreter ABI Platform
django_devbar-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.3 kB

Release files / django_devbar-1.0.0.tar.gz

Download URL django_devbar-1.0.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
04eff6e8b0673e42e31f9ba9a00d8fb15a9f58606242adce3ff238f22fd7e0c4
BLAKE2b-256 checksum
How to use checksums
c8363b82dbe58c60e835d7ff95b95164d46515336da36b3fecd988c104d2f4b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / django_devbar-1.0.0-py3-none-any.whl

Download URL django_devbar-1.0.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04eea48d6bfd00d13727e13c4f4d92947d0f1b773b0810611a50cc471bad6f6e
BLAKE2b-256 checksum
How to use checksums
b478b242bb2614d401dbfb5ce1c3d321a805a8d5cdaa717634fa01562c81ad10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Security for django-devbar 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_devbar-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page