Silk is a Django package that records HTTP requests, SQL queries, and optional Python profiles, then exposes them in a /silk/ web UI for debugging slow pages and queries.
Overview
Silk is a profiling and inspection tool for Django applications. Middleware intercepts requests and responses, stores timing and metadata, and wraps SQL execution to capture database activity for later review.
After installation and migrations, the UI is available at /silk/ on the same Django site. Request views show duration, query counts, headers, and optional bodies. SQL views summarize tables, joins, and execution time with stack traces.
Optional Python profiling uses cProfile when enabled, with downloadable .prof files and graph visualization when configured. Decorators and context managers profile arbitrary code blocks, and dynamic profiling can target functions at runtime via settings.
Silk can generate curl and Python snippets to replay requests, supports authentication for the UI, and offers settings to limit stored bodies, sample a fraction of traffic, ignore paths, and run garbage collection on old rows.
Key features
- HTTP request and SQL capture
- Web UI at /silk/
- Optional cProfile per request
- Code block profiling decorators
- Dynamic profiling via settings
- Replay snippets and auth for UI
Use cases
- Finding slow Django views and queries
- Profiling specific code paths in dev
- Sharing reproducible request replays