django-maintenance-mode
shows a 503 error page when maintenance-mode is on.
What it is and what it does
django-maintenance-mode is a Django middleware that intercepts requests and returns a 503 Service Unavailable response when maintenance mode is enabled. It operates at the application level without touching the database or requiring the server to restart, making it suitable for planned downtime, deployments, or migrations. The middleware can be configured to exclude specific users (staff, superusers, authenticated), IP addresses, or URL patterns, and supports multiple state backends (local file, cache, storage) to track whether maintenance mode is active.
The package is designed for developers who need to take their Django site offline temporarily while keeping the application running. It handles response customization (HTML or JSON), redirect URLs, retry headers, and context processors for template rendering. Configuration is entirely optional—sensible defaults apply if not specified—and the middleware can be positioned in the stack to control which other middleware executes during maintenance.
Use it for:
- Display a maintenance page during database migrations or schema updates without restarting the application.
- Temporarily take a site offline for emergency fixes or deployments while keeping the server process running.
- Allow staff and superusers to continue accessing the admin site or specific URLs while other users see the maintenance page.
- Return JSON responses for API endpoints during maintenance while serving HTML to web browsers.
- Redirect users to an external status page or alternative URL during planned downtime.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Activates a 503 maintenance page in Django applications without requiring database access or stopping the application server.
Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and solves a common operational need in Django deployments. The permissive MIT license and broad Django version support (4.2 through 6.0) make it a safe choice for most projects. Install it if you need to take your site offline without restarting the server.
Install
django-maintenance-mode on PyPI
pip
pip install django-maintenance-modeuv
uv add django-maintenance-modepoetry
poetry add django-maintenance-modeInstalling django-maintenance-mode
Before you install
Low install friction with a single wheel distribution. Actively maintained with a recent release (31 days old) and consistent commit activity. Depends only on django and python-fsutil.
License in practice
MIT license (permissive) allows commercial and private use with minimal restrictions.
Quickstart
pip install django-maintenance-mode
# In settings.py:
INSTALLED_APPS = [
'maintenance_mode',
# ...
]
MIDDLEWARE = [
# ...
'maintenance_mode.middleware.MaintenanceModeMiddleware',
]
# Create templates/503.html, then toggle:
MAINTENANCE_MODE = True
Requires a custom 503.html template in your templates directory; middleware position matters for which middleware executes during maintenance mode.
Verify before relying
- Whether python-fsutil has any known issues or maintenance concerns not reflected in this package's security record.
- Whether the local file backend state file is safe for concurrent writes in multi-process deployments.
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — django, python-fsutil |
| Maintenance | actively maintained — 31 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 278,084/month — #8,138 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_maintenance_mode-0.23.0-py3-none-any.whl
Keywords: django, maintenance, mode, offline, under, 503, service, temporarily, unavailable
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
dj-rest-authProvides drop-in REST API endpoints for user…
permissive · top 5,000 on PyPI
dj-materialized-viewsManages PostgreSQL materialized views through a…
permissive · top 15,000 on PyPI
django-loginasAdds a "Log in as user" button to the Django…
permissive · top 5,000 on PyPI
django-dirtyfieldsTracks which fields on a Django model instance…
permissive · top 15,000 on PyPI
django-browser-reloadAutomatically reloads your browser when you…
permissive · top 15,000 on PyPI
django-querycountDjango middleware that logs the number of…
permissive · top 15,000 on PyPI
django-pgmigratePrevents migration downtime by detecting and…
permissive · top 5,000 on PyPI
django-impersonateAllows Django superusers to temporarily assume…
permissive · top 15,000 on PyPI
django-upgradeAutomatically modernizes Django project code by…
permissive · top 15,000 on PyPI