From d2b3db020a2c0791080a17045313e2037e027cee Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@bioforsk.no> Date: Fri, 28 Aug 2015 14:04:07 +0200 Subject: [PATCH] Added maintenance mode feature for the site using the module django-maintenancemode --- VIPSWeb/local_settings_sample.py | 1 + VIPSWeb/settings.py | 1 + VIPSWeb/templates/503.html | 7 +++++++ requirements.txt | 1 + 4 files changed, 10 insertions(+) create mode 100644 VIPSWeb/templates/503.html diff --git a/VIPSWeb/local_settings_sample.py b/VIPSWeb/local_settings_sample.py index a10a0242..c95ad114 100644 --- a/VIPSWeb/local_settings_sample.py +++ b/VIPSWeb/local_settings_sample.py @@ -26,6 +26,7 @@ import os from django.utils.translation import ugettext_lazy as _ DEBUG = True +MAINTENANCE_MODE = False TEMPLATE_DEBUG = DEBUG # Hosts/domain names that are valid for this site; required if DEBUG is False diff --git a/VIPSWeb/settings.py b/VIPSWeb/settings.py index 5366f8df..1f0025d5 100644 --- a/VIPSWeb/settings.py +++ b/VIPSWeb/settings.py @@ -93,6 +93,7 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.messages.middleware.MessageMiddleware', 'common.middleware.whodid.WhodidMiddleware', 'django.middleware.locale.LocaleMiddleware', + 'maintenancemode.middleware.MaintenanceModeMiddleware', # Uncomment the next line for simple clickjacking protection: # 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) diff --git a/VIPSWeb/templates/503.html b/VIPSWeb/templates/503.html new file mode 100644 index 00000000..e535b03b --- /dev/null +++ b/VIPSWeb/templates/503.html @@ -0,0 +1,7 @@ +{% extends "base.html" %} +{% load i18n %} +{% block title %}{% trans "Temporarily down for maintenance" %}{% endblock %} +{% block content %} +<h1>{% trans "Temporarily down for maintenance" %}</h1> +<p>{% trans "We are sorry, but the web site is currently underdoing maintenance. We should be back online shortly." %}</p> +{% endblock %} diff --git a/requirements.txt b/requirements.txt index 006a05f2..1642a65d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,3 +23,4 @@ Pillow requests==2.0.1 django-tinymce python-dateutil==1.5 +django-maintenancemode -- GitLab