Shutdown software enables temporary site closure for maintenance purposes.
Installation of this application is very easy and can be done in a few simple steps. You can download django-maintenancemode from the provided link or install it using the following command: python setup.py install. In your Django settings file, you need to add a line for maintenancemode to your MIDDLEWARE_CLASSES, ensuring it comes after the AuthenticationMiddleware. Here's an example:
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'maintenancemode.middleware.MaintenanceModeMiddleware',
)
The application works similarly to handling 404 or 500 errors in Django. It adds a handler503 which can be overridden in your main urls.py or you can add a 503.html to your templates directory. In your Django settings file, add a variable called MAINTENANCE_MODE and set it to True to activate the middleware.
If you don't configure certain settings in your own project settings.py file, django-maintenancemode will use default values. For example, the MAINTENANCE_MODE variable is a boolean that enables or disables maintenance mode. By default, it is set to False.
It's worth noting that if a logged-in user is a staff member, the maintenance page will not be displayed to them. Similarly, if a user's IP is in INTERNAL_IPS, the maintenance page will not be shown either. Overall, django-maintenancemode is an excellent application that is incredibly easy to set up and use, and is a must-have for anyone who needs to put their site in maintenance mode.
Version 0.9.2: N/A