django-chronos 
Django middleware that shows you how fast your pages load, right in your browser. Displays request timing and query counts for your views and middleware.
Installation
Install Django Chronos using pip:
pip install django-chronos
Quick Start
- Add to INSTALLED_APPS in your Django settings:
INSTALLED_APPS = [
# ... your other apps
'django_chronos',
]
- Add middleware to your Django settings (order matters):
MIDDLEWARE = [
'django_chronos.middleware.ChronosStartMiddleware', # Must be first
# ... your other middleware
'django_chronos.middleware.ChronosEndMiddleware', # Must be last
]
- Run your Django application and visit any page. You'll see a stats overlayed in the bottom-left corner.
Configuration
CHRONOS_SHOW_IN_PRODUCTION (default: False)
Controls whether stats are shown in production mode (DEBUG=False). Stats are only shown to superusers in production. Stats always show in DEBUG mode.
CHRONOS_SHOW_IN_PRODUCTION = True
CHRONOS_SWAP_METHOD (default: 'prepend')
Controls how the stats are inserted into the response:
'prepend': Insert stats before the target'append': Insert stats after the target'replace': Replace the target with stats
CHRONOS_SWAP_METHOD = 'append'
CHRONOS_SWAP_TARGET (default: '</body>')
The string in the response where stats will be swapped in. Stats will not be displayed if this string does not exist in the response.
CHRONOS_SWAP_TARGET = '</body>'
Customizing the Stats Display
You can override the default stats display by creating your own chronos/chronos.html template in your Django project.
The template receives the following context variables:
middleware_cpu_time,middleware_sql_time,middleware_sql_count,middleware_total_timeview_cpu_time,view_sql_time,view_sql_count,view_total_timetotal_cpu_time,total_sql_time,total_sql_count,total_time
Note: In production mode, the *_sql_time and *_sql_count variable values will be zero (why?). You can wrap these variables in {% if debug %} blocks to stop them from displaying in production.
License
This project is open source and available under the MIT License.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Appreciation
Adam Hill for the inspiration via his Mastodon thread.
Metadata
Release files for django-chronos 250808
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 | |
|---|---|---|---|---|
| django_chronos-250808.tar.gz | 4.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_chronos-250808-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / django_chronos-250808.tar.gz
| Download URL | django_chronos-250808.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9241474d3bb4bae82b7824bd94ef14edc2ca921675e64467ca42bda2c44cbd8b
|
|
BLAKE2b-256 checksum How to use checksums |
4f50506f95524c427a2f0cfd418e56bc6edd2a6da7a370cf88b8f3b71d23985e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.3
|
Release files / django_chronos-250808-py3-none-any.whl
| Download URL | django_chronos-250808-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bf6db1c0d29a895c34457d5d00f695824c45622d816d4818e89429fb3766b03b
|
|
BLAKE2b-256 checksum How to use checksums |
5df96ddc60e99d2390880a86f86c63206036d8b00c3bd213c36f5c3ccbb1f4ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.3
|
Security for django-chronos 250808
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.