True hot reload for Django and Python web frameworks - no server restart needed
Project description
🔥 superreload
True hot reload for Django and Python web frameworks — no server restart needed.
superreload watches your Python files and automatically reloads modules when they change, then refreshes your browser via WebSocket. This dramatically speeds up the development feedback loop.
Features
- Instant reload: Python modules reload without restarting the server
- Browser auto-refresh: WebSocket-based browser refresh on file changes
- CSS hot reload: Stylesheets update without page refresh
- Error overlay: Beautiful error display with stack traces and local variables
- Keyboard shortcuts: Manual reload via Ctrl+Shift+R (browser) or 'r' + Enter (console)
- Django-first: Deep Django integration with view, template, and URL cache clearing
- Extensible: Framework-agnostic core with pluggable framework adapters
- Zero config: Works out of the box with sensible defaults
Installation
pip install superreload[django]
Or with uv:
uv add superreload[django]
Quick Start (Django)
1. Add to INSTALLED_APPS
# settings.py
INSTALLED_APPS = [
# ...
'superreload.frameworks.django',
# ...
]
2. Add the Middleware
# settings.py
MIDDLEWARE = [
'superreload.frameworks.django.SuperReloadMiddleware',
# ... other middleware
]
3. Run the Development Server
python manage.py superreload
Or with an address:
python manage.py superreload 0.0.0.0:8000
That's it! Edit any Python, HTML, CSS, or JS file and watch your browser update automatically.
How It Works
- File Watcher: Monitors your project for
.py,.html,.css,.jschanges - Module Reloader: Intelligently reloads changed Python modules and their dependents
- WebSocket Server: Notifies connected browsers to refresh
- Middleware: Injects a tiny JavaScript client into HTML responses
- CSS Hot Reload: Swaps stylesheets without full page refresh
- Error Overlay: Shows reload errors with full stack traces in the browser
Configuration
WebSocket Port
Default port is 9877. Change it via:
python manage.py superreload --ws-port 9999
WebSocket Host
Default host is localhost. Change it via:
python manage.py superreload --ws-host 0.0.0.0
WebSocket Path
Default path is /superreload. Useful for Docker/reverse proxy setups:
python manage.py superreload --ws-path /my-custom-path
Disable superreload
Run without hot reloading:
python manage.py superreload --no-reload
Manual Reload
Trigger a manual reload at any time:
- Browser: Press
Ctrl+Shift+R(orCmd+Shift+Ron Mac) - Console: Press
r+Enterin the terminal running superreload
Production
The middleware only activates when DEBUG = True. In production, it does nothing.
Supported Frameworks
- ✅ Django (4.2+)
- 🔜 Flask (coming soon)
- 🔜 FastAPI (coming soon)
Requirements
- Python 3.9+
- Django 4.2+ (for Django integration)
Development
# Clone the repo
git clone https://github.com/superreload/superreload.git
cd superreload
# Install dependencies
uv sync --dev
# Run tests
uv run pytest
# Lint
uv run ruff check src tests
# Type check
uv run mypy src
Architecture
superreload/
├── core/
│ ├── errors.py # Error formatting with local variables
│ ├── framework.py # Base framework abstraction
│ ├── reloader.py # Python module reloading
│ ├── watcher.py # File system watching
│ └── websocket.py # WebSocket server
└── frameworks/
└── django/
├── framework.py # Django-specific reload logic
├── middleware.py # Auto-inject JS client + error overlay
└── reload_server.py # Orchestrates everything
License
MIT License - see LICENSE for details.
Contributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file superreload-0.1.0.tar.gz.
File metadata
- Download URL: superreload-0.1.0.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4282f2193a9dccb0086ab8292c3b973a31d23af920cd58c8fb2ee35e13b2de6d
|
|
| MD5 |
f9cfbb091e6255379a819f21e1af91fe
|
|
| BLAKE2b-256 |
27ad6bbfa7854f130b379e2fd5f9d25410f4e68f2ce42d3501d7d7f3669844d9
|
File details
Details for the file superreload-0.1.0-py3-none-any.whl.
File metadata
- Download URL: superreload-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e80a7f41fe1966712cd587733469a9e100c777e3f6bf41354bed0044ff3c681
|
|
| MD5 |
45911cd343c54eace04def8805e14938
|
|
| BLAKE2b-256 |
18f057b530c308aac645acc29f1a9ae088b59794f57ee3a9319ae5b43c87cde7
|