Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

django-devbar - Lightweight performance devbar for Django.

Дата публикации: 12-01-2026 10:25:54



Основное содержимое страницы с новостью.

Warning

This package is experimental and may introduce breaking changes in minor versions.

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

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

Showcase

Normal operation – showing query count, duration, and application time:

devbar example

Similar and duplicate queries detected – severity indicators and details shown:

devbar warning example

[optional] Browser extension (Chrome and Firefox) — showing detailed metrics in DevTools panel:

Browser DevTools extension

Motivation

While Django Debug Toolbar is a proven tool trusted by countless projects, django-devbar explores a different approach to development debugging:

  • Minimal setup — just add middleware, nothing else required
  • Browser DevTools integration — extension panel works with any response type, including JSON
  • Zero extra dependencies — only requires Django
  • Lower overhead — no extra requests to debug endpoints
  • Non-intrusive — HTML bar is optional; works via headers and DevTools panel alone

Django Setup
# Using uv (recommended)
uv add --dev django-devbar

# Or using pip
pip install django-devbar

Add to your middleware early. For example:

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

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

This keeps the middleware active only in development and avoids import errors if the package isn't installed in production.

Configuration

All settings are optional. Configure via a DEVBAR dict 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 hard cap for q/dup entries sent to DevTools
}

Response Headers

Django DevBar adds HTTP response headers with performance metrics:

  • Server-Timing (always present) – Standard HTTP header with database, application, and total time metrics. Visible in browser DevTools Network tab under Timing.

An additional header is included by default in DEBUG mode:

  • DevBar-Data - JSON header with comprehensive metrics including similar and duplicate query details
    • Query-level flags are embedded in q entries (dup and sim)
    • Payload is automatically truncated to fit DEVTOOLS_HEADER_MAX_BYTES
    • When truncated, response includes metadata keys: tr, q_total, q_sent

This is useful for:

  • API endpoints where the HTML overlay can't be displayed
  • Automated testing to assert performance metrics (e.g., fail CI if query count exceeds a limit)
  • Browser extensions that need detailed duplicate query information

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

Browser Extension

View Django DevBar metrics directly in browser DevTools. Install from Chrome Web Store or Firefox Add-ons.

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

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1django-query-doctor: Diagnose Slow Django Queries03002-08-2026
2django-deadcode - dead code analysis tool026.6708-02-2026
3djangofmt - A fast, HTML aware, Django template formatter, written in Rust01021-02-2026
4django-arch-check: Static Checker for Common Django Issues024.2901-06-2026
5dj-control-room - The control room for your Django app021.1102-03-2026
6django-tasks-db - An ORM-based backend for Django Tasks03521-02-2026
7django-crawl - An in-process site crawler using Django’s test client028.1828-07-2026
8django-debug-toolbar - 6.2.003020-01-2026
9django-debug-toolbar - 6.3.003002-04-2026
10sqlit: TUI for SQL Databases01001-01-2026

Классификация: Пресс-релизы. Схожих патентов: 0. Схожих новостей: 10. Тональность: 0. Информативность: 24.29. Источник: pythondigest.ru.