Registry / web-framework / django-silk

django-silk

JSON →
library5.5.2pypypi✓ verified 25d ago

Django Silk is a live profiling and inspection tool for the Django framework, designed to help developers identify performance bottlenecks. It intercepts and stores HTTP requests, responses, and database queries, presenting them in an intuitive user interface for detailed analysis. Currently at version 5.5.0, it maintains an active release cadence, supporting recent Django and Python versions.

pip install django-silk
INSTALL
IMPORT
SIG · DJANGO-SILK
D
django-silk
web-frameworkpythonv5.5.2
Install
3.8s avg
Import
106ms
Disk
71MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.5.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.113s · 72.1MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 3.8s · import 0.099s · 73MB
71MB installed
● package 71MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

version
from silk import version
import silk

To quickly set up Django Silk, add 'silk' to `INSTALLED_APPS` and 'silk.middleware.SilkyMiddleware' to `MIDDLEWARE` in your Django settings. It's crucial to place `SilkyMiddleware` early in your `MIDDLEWARE` list to capture the entire request/response cycle; if using `GZipMiddleware`, place it before `SilkyMiddleware`. Finally, include 'silk.urls' in your project's `urls.py` and run `python manage.py migrate`.

# settings.py INSTALLED_APPS = [ # ... other apps 'silk', ] MIDDLEWARE = [ # Place SilkyMiddleware near the top to capture full request cycle # If using GZipMiddleware, place it *before* SilkyMiddleware. # 'django.middleware.gzip.GZipMiddleware', 'silk.middleware.SilkyMiddleware', # ... other middleware ] # Optional: Restrict access to Silk UI # SILKY_AUTHENTICATION = True # Requires user to be logged in # SILKY_AUTHORISATION = True # Requires logged-in user to be staff # LOGIN_URL = '/admin/login/' # Example for custom login URL if SILKY_AUTHENTICATION is True # urls.py from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('silk/', include('silk.urls', namespace='silk')), # ... other url patterns ] # After configuration, run migrations: # python manage.py migrate # Access the UI at /silk/
Debug
Known issues
breakingDjango Silk v5.3.0 removed support for Django 3.2 and Python 3.8. Ensure your environment meets the minimum requirements (Python >= 3.10, Django >= 4.2).
fix
Upgrade Python to 3.10+ and Django to 4.2+ or pin django-silk to a version prior to 5.3.0 (e.g., `django-silk==5.2.0`).
affects: >=5.3.0
deprecatedThe `SILKY_STORAGE_CLASS` setting was deprecated in version 5.1.0. Users should now leverage Django's standard `STORAGES` configuration for specifying storage backends.
fix
Migrate your storage configuration from `SILKY_STORAGE_CLASS` to the `STORAGES` setting as per Django's official documentation.
affects: >=5.1.0
gotchaThe order of middleware is sensitive. If `silk.middleware.SilkyMiddleware` is placed after another middleware that returns a response without calling `get_response`, Silk will not profile that request. If using `django.middleware.gzip.GZipMiddleware`, it must be placed *before* `SilkyMiddleware` to avoid encoding errors.
fix
Place `silk.middleware.SilkyMiddleware` as high as possible in your `MIDDLEWARE` list. Ensure `django.middleware.gzip.GZipMiddleware` is positioned before it if used.
affects: all
gotchaUsing Django Silk in production environments is generally not recommended due to performance overhead (intercepting and storing all request/response data), potential for significant database storage growth, and security implications (exposing application internals).
fix
Restrict Django Silk to development and staging environments. Use environment variables or Django settings to enable/disable it conditionally.
affects: all
gotchaThere have been recurring fixes related to serialization issues for binary and JSON fields, as well as race conditions when modifying SQL execution, in versions 5.4.x. While fixed, this indicates potential instability in complex serialization scenarios.
fix
Ensure you are on the latest patch release (e.g., 5.4.3 or newer) and thoroughly test profiling with custom binary or JSON fields. Report any new issues to the maintainers.
affects: 5.4.x
gotchaWhen using Python 3.12 or later, the built-in `cProfile` (used by Silk for Python profiling) cannot run concurrently. This means if another profile is already running, Silk's Python profiler will not execute.
fix
Be aware of this limitation when profiling in multi-threaded or concurrent environments with Python 3.12+. Consider other profiling approaches for concurrent code sections if precise timing is needed across concurrent operations.
affects: >=3.12
Upgrade
Version history
5.5.2latest on PyPI · released Aug 13, 2026
Audit
Dependencies
DjangorequiredCore framework integration; tested with Django 4.2, 5.1, 5.2, 6.0.
Agent activity
26 hits · last 30 days
node
22
OpenAI (training)
2
Resources