django-prometheus
Django middlewares to monitor your application with Prometheus.io.
Decision gist · record as of 2026-08-14
Yes. django-prometheus is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. It provides production-grade Prometheus instrumentation for Django with minimal setup—add middleware and a URL include, then scrape /metrics. Suitable for any Django project that needs observability without custom instrumentation code.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Django >= 4.2 and Python 3.9 or above.
- Low friction install with just two runtime dependencies (Django and prometheus-client).
- Package is actively maintained with a recent release and no known vulnerabilities.
License · maintenance · safety
Apache (permissive) — Apache License (permissive) — you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
last release 2026-05-26 (80 days) · last repo commit 2026-07-30 · 1,662 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,542,374 downloads/mo, #2,285 on PyPI
Alternatives
Verify before relying
pip install django-prometheus
# In settings.py
INSTALLED_APPS = ['django_prometheus', ...]
MIDDLEWARE = [
'django_prometheus.middleware.PrometheusBeforeMiddleware',
# ... other middleware ...
'django_prometheus.middleware.PrometheusAfterMiddleware',
]
# In urls.py
urlpatterns = [path('', include('django_prometheus.urls')), ...]What it is and what it does
django-prometheus is a Django middleware and instrumentation library that automatically collects and exports application metrics in Prometheus format. It hooks into Django's request/response cycle, ORM database operations, cache framework, and model lifecycle to generate counters, histograms, and gauges that Prometheus can scrape. You install it as a Django app, add two middleware classes to your stack, and expose a /metrics endpoint; the library then begins collecting latency, request counts, database query metrics, cache hit/miss rates, and model operation counts without requiring changes to your application code.
The package works with SQLite, MySQL, and PostgreSQL databases, supports filebased, memcached, and redis caches, and allows custom metric labels and namespacing. It integrates directly with prometheus-client and lets you add application-level metrics alongside the built-in Django instrumentation. Configuration is minimal—you can customize latency histogram buckets and metric prefixes in settings—making it suitable for both greenfield and legacy Django projects that need observability without heavy refactoring.
Use it for
- Monitor HTTP request latency and throughput across your Django application endpoints in real time.
- Track database query performance and frequency to identify slow ORM operations and N+1 problems.
- Alert on cache hit/miss rates and eviction patterns to optimize caching strategy.
- Export model creation, update, and deletion rates to detect anomalous data mutation patterns.
- Collect migration status metrics to ensure all pending database migrations are applied.
- Add custom application-level metrics alongside Django internals using prometheus-client directly.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
django-prometheus is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. It provides production-grade Prometheus instrumentation for Django with minimal setup—add middleware and a URL include, then scrape /metrics. Suitable for any Django project that needs observability without custom instrumentation code.
Install
django-prometheus on PyPI
Before you install
Low friction install with just two runtime dependencies (Django and prometheus-client). Package is actively maintained with a recent release and no known vulnerabilities.
Requires Django >= 4.2 and Python 3.9 or above.
License in practice
Apache License (permissive) — you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install django-prometheus
# In settings.py
INSTALLED_APPS = ['django_prometheus', ...]
MIDDLEWARE = [
'django_prometheus.middleware.PrometheusBeforeMiddleware',
# ... other middleware ...
'django_prometheus.middleware.PrometheusAfterMiddleware',
]
# In urls.py
urlpatterns = [path('', include('django_prometheus.urls')), ...]
Package facts
| License | Apache permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesDjangoprometheus-client |
| Maintenance | Actively maintained 80 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,542,374 / month, #2,285 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: Django :: 4.2Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Free ThreadingTopic :: System :: Monitoring |
Evidence: django_prometheus-2.5.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django prometheus metrics”
- django-prometheusExports Django application metrics (requests, database queries, cache…
- opentelemetry-exporter-prometheusExports OpenTelemetry metrics to Prometheus for scraping and…
- prometheus-clientInstruments Python applications to expose metrics in Prometheus…
Give your agent the search over MCP, or paste the wish link into any chat.
More Monitoring packages
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
Provides generated Python code for OpenTelemetry semantic conventions, enabling standardized attribute naming and constant definitions for instrumentation and telemetry collection.
Install it if you are using OpenTelemetry and want to follow semantic conventions correctly.
Provides the reference implementation of the OpenTelemetry API for collecting and exporting traces, metrics, and logs from Python applications.
Provides the abstract API and interfaces for OpenTelemetry instrumentation in Python, defining how to emit traces, metrics, and logs without tying code to a specific SDK implementation.
Exports OpenTelemetry observability data to an OpenTelemetry Collector using Protobuf-encoded messages over HTTP.
Install it if you are using OpenTelemetry in Python and need to send data to a Collector over HTTP.
Provides automatic instrumentation commands and programmatic APIs to inject distributed tracing into Python applications without code changes, detecting and instrumenting packages used by your program.
Install it if you need distributed tracing without code changes and have compatible instrumented packages in your environment.
See also prometheus-client · opentelemetry-exporter-prometheus · prometheus-flask-exporter · py-grpc-prometheus · starlette-exporter · prometheus-async · opentelemetry-exporter-prometheus-remote-write · prometheus-client-python-speedups · django-health-check · prometheus-remote-writer