django-silk
Silky smooth profiling for the Django Framework
What it is and what it does
Silk is a live profiling and inspection tool built as Django middleware that automatically intercepts HTTP requests, responses, and database queries, storing them in the configured database for later inspection. It provides a web UI to explore request metadata (timing, query counts, headers, bodies), SQL execution details, and optional Python cProfile output with graph visualization via gprof2dot. Developers can also manually profile specific code blocks or functions using decorators or context managers.
The package depends on Django, sqlparse for SQL parsing, and gprof2dot for profiler graph generation. It supports Django 4.2 through 6.0 and Python 3.10–3.15. Configuration is straightforward—add the middleware and app to settings, include URLs, run migrations, and the UI becomes available. Middleware ordering matters: GZipMiddleware must precede Silk's middleware to avoid encoding issues, and any middleware before Silk that returns early will prevent profiling.
Use it for:
- Identify slow database queries and N+1 problems by inspecting SQL execution within individual requests.
- Profile view functions and code blocks to find performance bottlenecks using cProfile integration and decorator-based profiling.
- Debug request/response issues by examining headers, bodies, and timing data through the web UI without code changes.
- Analyze which endpoints generate the most queries or consume the most time during development and testing.
- Generate downloadable .prof files for deeper analysis with tools like snakeviz or other cProfile utilities.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Silk intercepts and profiles HTTP requests, database queries, and code execution in Django applications, displaying results in a web UI for inspection and analysis.
Yes. Silk is a mature, actively maintained profiling tool with low install friction and no known vulnerabilities. It integrates seamlessly into Django projects via middleware and provides both automatic request profiling and manual code profiling. Ideal for development and staging environments to diagnose performance issues; production use requires careful configuration to limit data retention and avoid overhead.
Install
django-silk on PyPI
pip
pip install django-silkuv
uv add django-silkpoetry
poetry add django-silkInstalling django-silk
Before you install
Low friction installation with three runtime dependencies. Active maintenance with recent commits and a stable production status across Django 4.2 through 6.0 and Python 3.10–3.15.
License in practice
MIT License permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
Quickstart
pip install django-silk
# In settings.py:
MIDDLEWARE = [..., 'silk.middleware.SilkyMiddleware', ...]
INSTALLED_APPS = (..., 'silk')
# In urls.py:
urlpatterns += [path('silk/', include('silk.urls', namespace='silk'))]
# Then: python manage.py migrate && python manage.py collectstatic
# Access UI at /silk/
Middleware order is sensitive; GZipMiddleware must be placed before SilkyMiddleware to avoid encoding errors. Python 3.10+ required.
Verify before relying
- Whether cProfile concurrency limitation on Python 3.12+ significantly impacts real-world profiling workflows.
- Performance overhead of request/response interception in high-traffic production environments.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — Django, sqlparse, gprof2dot |
| Maintenance | actively maintained — 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,593,281/month — #2,977 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_silk-5.5.2-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
django-cprofile-middlewareMiddleware that profiles Django view execution…
permissive · top 15,000 on PyPI
django-queryinspectDjango middleware that logs and reports SQL…
permissive · top 15,000 on PyPI
django-querycountDjango middleware that logs the number of…
permissive · top 15,000 on PyPI
drf-api-loggerCaptures and logs Django REST Framework API…
permissive · top 15,000 on PyPI
django-graphiql-debug-toolbarIntegrates Django Debug Toolbar into the…
permissive · top 15,000 on PyPI
requests-trackerA Django development middleware that collects…
permissive · top 15,000 on PyPI
Flask-SilkProvides a Flask integration to serve Silk icon…
permissive · top 15,000 on PyPI
snakevizSnakeViz is a web-based viewer for Python…
permissive · top 5,000 on PyPI
sqltapsqltap hooks into SQLAlchemy to collect and…
permissive · top 15,000 on PyPI
fastapi-profilerIntegrates pyinstrument profiling into FastAPI…
permissive · top 15,000 on PyPI