django-querycount
Middleware that Prints the number of DB queries to the runserver console.
Decision gist · record as of 2026-08-14
Yes, if you are actively developing a Django application and want low-friction query profiling during local testing. The permissive MIT license and zero runtime dependencies make it easy to add. However, maintenance is dormant (last release 2023-01-05); verify compatibility with your Django and Python versions before relying on it. The high install friction is offset by the simplicity of the middleware pattern.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Django project with DEBUG=True; middleware must be manually registered in MIDDLEWARE setting.
- High install friction with no runtime dependencies but requires manual middleware registration in Django settings.
- Maintenance is dormant—last release was 2023-01-05, though the repository remains active with a recent commit on 2024-05-29 and 408 stars.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) allows free use, modification, and distribution with minimal restrictions. No licensing barrier to adoption.
last release 2023-01-05 (1317 days) · last repo commit 2024-05-29 · 408 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 153,337 downloads/mo, #10,883 on PyPI
Alternatives
Verify before relying
pip install django-querycount
# In Django settings.py, add to MIDDLEWARE:
MIDDLEWARE = [
'querycount.middleware.QueryCountMiddleware',
# ...
]
# Optional: configure thresholds
QUERYCOUNT = {
'THRESHOLDS': {'MEDIUM': 50, 'HIGH': 200}
}- Compatibility with current Django versions relative to the 2023-01-05 release date.
- Whether the package works with modern Python versions beyond what the fact sheet specifies.
- Whether high install friction reflects a known blocker or is typical for middleware packages.
What it is and what it does
django-querycount is a Django middleware that intercepts HTTP requests during development and logs how many database queries were executed to handle each request. It prints colored, threshold-based output to the runserver console, helping developers spot performance issues early. The middleware is hardcoded to work only when DEBUG is True, making it safe for development-only use.
The package offers configurable thresholds to color-code query counts (MEDIUM at 50, HIGH at 200), regex-based request and SQL pattern filtering to ignore certain paths or query types, optional duplicate query reporting, and a custom response header containing the query count. It has no runtime dependencies and integrates purely through Django's middleware stack.
Use it for
- Identify query problems during local development by monitoring query counts per request.
- Compare query efficiency across different request handlers to spot performance issues.
- Filter out noisy middleware (e.g., health checks, admin requests) to focus on application endpoints.
- Track duplicate queries to find repeated database calls that could be optimized.
- Add query count metadata to HTTP response headers for integration with monitoring tools.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are actively developing a Django application and want low-friction query profiling during local testing.
The permissive MIT license and zero runtime dependencies make it easy to add. However, maintenance is dormant (last release 2023-01-05); verify compatibility with your Django and Python versions before relying on it. The high install friction is offset by the simplicity of the middleware pattern.
Install
django-querycount on PyPI
Before you install
High install friction with no runtime dependencies but requires manual middleware registration in Django settings. Maintenance is dormant—last release was 2023-01-05, though the repository remains active with a recent commit on 2024-05-29 and 408 stars. Use only if you accept infrequent updates.
Requires Django project with DEBUG=True; middleware must be manually registered in MIDDLEWARE setting.
License in practice
MIT license (permissive) allows free use, modification, and distribution with minimal restrictions. No licensing barrier to adoption.
Quickstart
pip install django-querycount
# In Django settings.py, add to MIDDLEWARE:
MIDDLEWARE = [
'querycount.middleware.QueryCountMiddleware',
# ...
]
# Optional: configure thresholds
QUERYCOUNT = {
'THRESHOLDS': {'MEDIUM': 50, 'HIGH': 200}
}
Verify before relying
- Compatibility with current Django versions relative to the 2023-01-05 release date.
- Whether the package works with modern Python versions beyond what the fact sheet specifies.
- Whether high install friction reflects a known blocker or is typical for middleware packages.
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | High. Source build required |
| Runtime dependencies | None |
| Maintenance | Dormant 1,317 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 153,337 / month, #10,883 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaEnvironment :: Web EnvironmentFramework :: DjangoIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonTopic :: Utilities |
Evidence: django-querycount-0.8.3.tar.gz
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 query count logging”
- django-querycountDjango middleware that logs the number of database queries executed…
- django-queryinspectDjango middleware that logs and reports SQL query statistics for each…
- django-test-plusProvides a TestCase subclass for Django with helper methods to reduce…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also django-queryinspect · requests-tracker · django-zeal · django-silk · drf-api-logger · django-perf-rec · django-maintenance-mode · sqltap · django-sql-explorer · pygount