Skip to content
h0pbeat edited this page Oct 26, 2013 · 7 revisions

How to add a maintenance page

Using django-maintenancemode.

pip install django-maintenancemode

To enable for the site, add maintenancemode.middleware.MaintenanceModeMiddleware to MIDDLEWARE_CLASSES in settings.py.

When enabling the maintenance mode, all but admin-users will receive the 503 error page.

Configuration

The template 503.html is used by default to show the maintenance page. A special 503 handler can be assigned by adding handler503 = 'render.views.error_503' to the root urls.py.

Urls can be whitelisted in MAINTENANCE_IGNORE_URLS (using regexes). To whitelist the admin login interface add:

MAINTENANCE_IGNORE_URLS = (
    r'^.*/admin/$',
)

The ips in INTERNAL_IPS will not receive the 503 error at all:

INTERNAL_IPS = (
    '130.225.93.164',
)

Enabling the 503 page

Set MAINTENANCE_MODE = True in settings.py.

Clone this wiki locally