A debug toolbar for Django.
Overview
The kaleidoscope toolbar records what a request did and renders it as a set of panels over the page. There are twelve panels by default, covering SQL, templates, cache calls, signals, static files, settings, versions, timing, memory, the request itself, and two profilers. This is useful for finding N+1 queries, slow views, and template rendering costs during development.
The toolbar installs as a single middleware and mounts into a shadow root, so the page it inspects cannot restyle it and its own stylesheet cannot reach the page.
Prerequisites
- Django 4.2+
- Python 3.11+
DEBUGmust beTrue, unlessKALEIDOSCOPE_SHOW_CALLBACKis set
Installation
pip install django-kaleidoscope
Add the app, the middleware, and your address to your Django settings:
INSTALLED_APPS = [
'django_kaleidoscope'
]
MIDDLEWARE = [
'django_kaleidoscope.middleware.KaleidoscopeMiddleware'
]
INTERNAL_IPS = ['127.0.0.1']
The package was named kaleidoscope before, and settings that still use that name keep working through an alias. The kaleidoscope.W009 check names each setting to rename before a later release removes the alias.
The middleware belongs after GZipMiddleware. A compressed response carries a Content-Encoding and the injector refuses it, so a toolbar loaded first never appears. A system check reports the ordering at startup.
Configuration
| Setting | Description | Default |
|---|---|---|
INTERNAL_IPS |
The addresses that see the toolbar while DEBUG is on. |
[] |
KALEIDOSCOPE_IGNORE_PATHS |
The path prefixes the middleware skips. | [] |
KALEIDOSCOPE_PANELS |
The dotted paths of the panels to load, at most 64. The load order is the strip's default order. | The twelve defaults |
KALEIDOSCOPE_SHOW_CALLBACK |
A dotted path to a callable taking the request, replacing the DEBUG and INTERNAL_IPS check. It may be sync or async, and is adapted to whichever the request needs. |
None |
There are nine system checks at startup, reporting a missing middleware, a middleware registered twice, a middleware ordered before GZipMiddleware, an empty INTERNAL_IPS with no callback, a panel path that will not import, a panel that is not a Panel subclass, a KALEIDOSCOPE_PANELS that is not a list, a KALEIDOSCOPE_IGNORE_PATHS that is not a list of path prefixes, and a setting that still names the old kaleidoscope module.
Panels
| Panel | Description | Isolated |
|---|---|---|
| Timer | The wall time for the request, with its method, path, status, and whether it ran under ASGI. | |
| Versions | The versions of the installed packages. | |
| Request | The method, path, headers, cookies, GET and POST data, the resolver match, the session, the user, and each permission check. | |
| SQL Queries | Each statement with its time, parameters, stack, and template lines, grouped into duplicates and N+1 candidates, with its query plan on request. | |
| Templates | Each template rendered, including {% extends %} parents and {% include %} templates, with its duration and context. |
|
| Cache | Each add, clear, delete, delete_many, get, get_many, get_or_set, has_key, incr, set, and set_many call with its key, result, and time. |
|
| Static Files | The files referenced by the response, against each file the finders can see. | |
| Signals | Each signal the request sent with its sender, receivers, time, and call site, and the receivers connected to each signal. | |
| Settings | The resolved settings for the project. | |
| Memory | The heap difference across the request by type, split into allocated, freed, and unchanged. | Yes |
| Profiling | A pyinstrument call stack, rendered inline and openable in its own tab. | Yes |
| Line Profiler | The per-line hits, time, and share of total for the resolved view. | Yes |
The panels are toggled at runtime from the strip, which persists the panel order, side, active panel, and collapsed state in localStorage.
Example Project
The example/ directory holds a Django project written to be slow. The columns carry no db_index, the model properties open a query each time they are read, and the aggregates are folded in Python instead of the database. Each page names the mistakes it is making.
| Page | Queries | Total |
|---|---|---|
/books/ |
882 | 277 ms |
/search/ |
1603 | 444 ms |
/authors/ |
673 | 194 ms |
/reports/ |
602 | 169 ms |
/customers/ |
503 | 143 ms |
/orders/ |
327 | 287 ms |
/ |
96 | 38 ms |
/books/optimized/ |
4 | 33 ms |
The /books/optimized/ page renders the same sixty rows as /books/ using select_related, prefetch_related, and Count and Avg annotations, which is the difference between 882 queries and 4.
just setup
just reset
just run
The just screenshot recipe captures each panel into example/screenshot/ and accepts a filter, such as just screenshot queries.
Metadata
Release files for django-kaleidoscope 0.0.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_kaleidoscope-0.0.13.tar.gz | 203.3 kB | Without provenance | Details for django_kaleidoscope-0.0.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_kaleidoscope-0.0.13-py3-none-any.whl | Python 3 | none | any | Details for django_kaleidoscope-0.0.13-py3-none-any.whl |
Total release size: 417.6 kB
Release files / django_kaleidoscope-0.0.13.tar.gz
| Download URL | django_kaleidoscope-0.0.13.tar.gz |
|---|---|
| Size | 203.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8189b5245dc37b2cab096a492a758dd68c2e1ada7e7f91a3f01717490c375570
|
|
BLAKE2b-256 checksum How to use checksums |
054f172333653635511b38605b0f4ec98802a517accf22138118f80179312c20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / django_kaleidoscope-0.0.13-py3-none-any.whl
| Download URL | django_kaleidoscope-0.0.13-py3-none-any.whl |
|---|---|
| Size | 214.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
082f4aeea535e74d04b45e731603b8865f6563dc6cdb985bf1f92ba15b5223dd
|
|
BLAKE2b-256 checksum How to use checksums |
0b0e4825cdad54897673d08b3c60e0b77caaa035ba7b88d1512779aeabe3f62f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for django-kaleidoscope 0.0.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.