Django-maintenancemode allows you to temporary shutdown your site for maintenance work
Project description
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
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
File details
Details for the file tocka-django-maintenancemode-0.9.4.1.tar.gz
.
File metadata
- Download URL: tocka-django-maintenancemode-0.9.4.1.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ea1b128aa99feaa003274da97c82df5bd0eed4222a0a304e69f33fc297924cc |
|
MD5 | 507fba9c9d9f8c35dd52778adcd72d7a |
|
BLAKE2b-256 | e49d74c3dedfb5a224801311072980b6e4107e3987640e0d24fad105db158d41 |