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.3.tar.gz (4.6 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.3-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_devbar-0.1.3.tar.gz
  • Upload date:
  • Size: 4.6 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.3.tar.gz
Algorithm Hash digest
SHA256 3aa14c6765bc9f7c6c78e238fd8e05f4eb61eeb56d2c6980c5a9d21e110f03d4
MD5 997e70bcbf82b314830e712ccab54b8c
BLAKE2b-256 b38ff5b3abbbb08deaa794e5a89a9c496995cadad05e9f1fad8bdfeba73a7439

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_devbar-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: django_devbar-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2ff85cc3a76861c248c68edb592029d01b91d426a2bfabd1bb8a825bb1f24167
MD5 74c66c2810700d6c4395a97bc8711449
BLAKE2b-256 4304dbdb0140e804c5800c3fabfeb661915837dc2745878725b22b55e3db7923

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_devbar-0.1.3-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