--- id: django-silk version: "5.5.2" license: MIT License license_treatment: permissive maintenance: active --- # django-silk — Silky smooth profiling for the Django Framework License: permissive · Maintenance: active · Downloads: 2.6M/mo ## 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 above — 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 pip install django-silk uv add django-silk poetry add django-silk ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 2.6M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags django request profiling, django query inspector, django performance monitoring, django middleware profiler, django sql query analysis, django request response inspection, django cprofile integration, django-profiling, performance-debugging, request-inspection [View on SkillFed](https://skillfed.io/packages/django-silk) · [View on PyPI](https://pypi.org/project/django-silk/)