Skip to main content

Lightweight performance devbar for Django

Project description

django-devbar

Lightweight performance devbar for Django. Shows DB query count, query duration, application time, and detects duplicate queries with visual severity indicators.

devbar example

Installation

pip install django-devbar

Add to your middleware as early as possible, but after any middleware that encodes the response (e.g., GZipMiddleware):

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

Configuration

# Position: bottom-right, bottom-left, top-right, top-left (default: bottom-right)
DEVBAR_POSITION = "top-left"

# Show HTML overlay (default: DEBUG)
DEVBAR_SHOW_BAR = True

# Add DevBar-* response headers (default: False)
DEVBAR_SHOW_HEADERS = True

# Enable console logging for duplicate queries (default: True)
DEVBAR_ENABLE_CONSOLE = True

# Performance thresholds for warning/critical levels (defaults shown)
DEVBAR_THRESHOLDS = {
    "time_warning": 500,    # ms
    "time_critical": 1500,  # ms
    "count_warning": 20,    # queries
    "count_critical": 50,   # queries
}

Response Headers

When DEVBAR_SHOW_HEADERS = True, performance metrics are added as HTTP response headers. This is useful for:

  • API endpoints where the HTML overlay can't be displayed
  • Automated testing to assert performance thresholds (e.g., fail CI if query count exceeds a limit)
  • Monitoring tools that can capture and aggregate header values

Headers included:

Header Example Description
DevBar-Query-Count 12 Number of database queries executed
DevBar-DB-Time 87ms Total time spent in database queries
DevBar-App-Time 41ms Application time (total time minus DB time)
DevBar-Duplicates 3 Number of duplicate queries detected (only present if duplicates found)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_devbar-0.1.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_devbar-0.1.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file django_devbar-0.1.2.tar.gz.

File metadata

  • Download URL: django_devbar-0.1.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_devbar-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1c8ce24ade421977f2145b74897d45f0796278efb76dd81437ec75c3ab63781d
MD5 a807fbfbe0b7bdb145738249504bf981
BLAKE2b-256 522b9d09ce2e6355e20bc2d6815c7ecca327c2b173c7d96cf414aad92ba41001

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_devbar-0.1.2.tar.gz:

Publisher: release.yml on amureki/django-devbar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_devbar-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: django_devbar-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_devbar-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 31a7233024e041bf6b7c223b86e0882b24b55fae38998aa5de6552b37d752840
MD5 46b37946a561979fbca822216a0f71e3
BLAKE2b-256 d91461f4330789ee77c64557e0627d3239d1cf2c091f95a8f3dc03b00a56b7e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_devbar-0.1.2-py3-none-any.whl:

Publisher: release.yml on amureki/django-devbar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page