Skip to main content

Django maintenance panel: show maintenance page only to staff (non-superuser) while allowing superusers and public users.

Project description

django-maintenance-panel

Simple reusable Django app that provides a maintenance mode logic:

  • When maintenance_mode is off: nothing happens.
  • When maintenance_mode is on:
    • Superusers see the site normally.
    • Staff (non-superusers) see a maintenance page after login, with a logout button.
    • Anonymous users & non-staff users see the site normally.

Local install

Build and install:

python -m pip install --upgrade build
python -m build
pip install .

Django settings

INSTALLED_APPS = [
    # ...
    "maintenance_panel",
]

MIDDLEWARE = [
    # ...
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "maintenance_panel.middleware.MaintenanceModeMiddleware",
    # ...
]

TEMPLATES = [
    {
        # ...
        "OPTIONS": {
            "context_processors": [
                # ...
                "maintenance_panel.context_processors.maintenance_context",
            ],
        },
    },
]

Then:

python manage.py migrate maintenance_panel

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_maintenance_panel-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_maintenance_panel-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file django_maintenance_panel-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django_maintenance_panel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2ee6571d6acc823aedac16fd77659879a124e592ff072723a891b408ea2cc341
MD5 b4a746fc1cd7250de40a284031d7ea56
BLAKE2b-256 9299479761714ed2b87c40e4e193482882f2856ef1219f8241688f2dd73d164d

See more details on using hashes here.

File details

Details for the file django_maintenance_panel-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_maintenance_panel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d35971f69700a393de4624cc9a1bdec31625a0776438d31ca9e8cf7941dd508
MD5 7e8d68f6071e422fcacb5f093d5fd28a
BLAKE2b-256 13447af04ae1889e0e7d209bff5624c649896a8a6f6ce6b2568b0a22578ef376

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page