Skip to main content
https://travis-ci.org/frnhr/django-maintenancemode.svg

django-maintenancemode is a middleware that allows you to temporary shutdown your site for maintenance work.

When site is in maintenance mode, some user can still access the regular site:
  • logged in users having staff credentials, and

  • users visiting the site from an ip address defined in Django’s INTERNAL_IPS.

The two points above are just the defaults, configured in PERMISSION_PROCESSORS setting (see below). Custom rules are easy to plug in.

django-maintenancemode works the same way as handling 404 or 500 errors in Django work. It adds a handler503 which you can override in your main urls.py or you can add a 503.html to your templates directory.

Forking history:
  • This fork adds the permission processors framework.

  • Older fork moved the maintenance mode property and ignored urls out of settings.py and into your database.

Requirements

django.contrib.sites

Sites must have at least one domain to work properly.

Plugin is fully tested with:
  • Django 1.7.8

  • Django 1.8.2

  • Python 2.7.9

  • Python 3.4.2

Installation

  • Install using pip install tocka-django-maintenancemode

  • Or if you no like pip: download the source and python setup.py install

  • In your Django settings file add maintenancemode to your MIDDLEWARE_CLASSES. Make sure it comes after Django’s AuthenticationMiddleware. Like so:

    MIDDLEWARE_CLASSES = (
        # ...
    
        'maintenancemode.middleware.MaintenanceModeMiddleware',
    )
  • Add maintenancemode to your INSTALLED_APPS.

  • Run manage.py migrate to create the necessary tables.

  • Adding the middleware and running your site creates the necessary records in the database to enable/disable maintenance mode and ignored URL patterns.

Configuration

Config section is not up-to-date :(

MAINTENANCE MODE

Maintenance mode will create a database record per site, read from the domains you have in the Sites app. There is a boolean property on each Maintenance model, “is_being_performed” that takes the place of putting the site into “maintnenace mode” from settings.py

MAINTENANCE IGNORE URLS

Patterns to ignore are registered as an inline model for each maintenance record created when the site is first run. Patterns should begin with a forward slash: /, but can end any way you’d like.

Todo

  • document configuration

  • document permission processors

  • sort out the ignored urls feature

  • tests for admin interface?

  • pypi package

  • omg make this readme in markdown

Changes == == == =

developement - - - - - - - - - - - -

0.9.4 - - - - - - Tests for changes from 0.9.3 - Django 1.7 and 1.8 compatibility - Pluggable permissions schema

0.9.3 - - - - - - Moved maintenance mode and ignored url patterns from settings.py to database backed storage.

0.9.2 - - - - - - Fixed an issue with setuptools, thanks for reporting this ksato9700

0.9.1 - - - - -

  • Tested django - maintenancemode with django - 1.0 release (following the 1.0.X release branch)

  • Bundled buildout.cfg and bootstrap with the source version of the project, allowing repeatable buildout

  • The middleware now uses its own default config file, thanks to a patch by semente

  • Use INTERNAL_IPS to check for users that need access. user.is_staff will stay in place for backwards incompatibility. Thanks for the idea Joshua Works

  • Have setup.py sdist only distribute maintenancemode itself, no longer distribute tests and buildout stuff

  • Use README and CHANGES in setup.py’s long_description, stolen from Jeroen’s djangorecipe :)

  • Updated the documentation and now use pypi as the documentation source (link there from google code)

0.9 - - - - -

First release

Metadata

Release files for tocka-django-maintenancemode 0.9.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tocka-django-maintenancemode 0.9.4.1
File Size Uploaded Provenance Actions
tocka-django-maintenancemode-0.9.4.1.tar.gz 6.4 kB Without provenance Details for tocka-django-maintenancemode-0.9.4.1.tar.gz

Release files / tocka-django-maintenancemode-0.9.4.1.tar.gz

Download URL tocka-django-maintenancemode-0.9.4.1.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0ea1b128aa99feaa003274da97c82df5bd0eed4222a0a304e69f33fc297924cc
BLAKE2b-256 checksum
How to use checksums
e49d74c3dedfb5a224801311072980b6e4107e3987640e0d24fad105db158d41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for tocka-django-maintenancemode 0.9.4.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.4.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page