Skip to content
Snippets Groups Projects
Commit 5312f8d7 authored by Fabien  MAREUIL's avatar Fabien MAREUIL
Browse files

maintenance page

parent a08065e9
No related branches found
No related tags found
1 merge request!29Prepare for v1.1.0
Pipeline #46840 failed
...@@ -60,6 +60,7 @@ INSTALLED_APPS = [ ...@@ -60,6 +60,7 @@ INSTALLED_APPS = [
"rest_framework", "rest_framework",
"polymorphic", "polymorphic",
"biodblinks", "biodblinks",
"maintenance_mode",
] ]
MIDDLEWARE = [ MIDDLEWARE = [
...@@ -73,6 +74,7 @@ MIDDLEWARE = [ ...@@ -73,6 +74,7 @@ MIDDLEWARE = [
"django.contrib.messages.middleware.MessageMiddleware", "django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware",
"debug_toolbar.middleware.DebugToolbarMiddleware", "debug_toolbar.middleware.DebugToolbarMiddleware",
"maintenance_mode.middleware.MaintenanceModeMiddleware",
] ]
ROOT_URLCONF = "ippisite.urls" ROOT_URLCONF = "ippisite.urls"
...@@ -91,6 +93,7 @@ TEMPLATES = [ ...@@ -91,6 +93,7 @@ TEMPLATES = [
"ippidb.views.marvinjs", "ippidb.views.marvinjs",
"ippidb.views.google_analytics", "ippidb.views.google_analytics",
"live_settings.context_processors.processors", "live_settings.context_processors.processors",
"maintenance_mode.context_processors.maintenance_mode",
] ]
}, },
} }
...@@ -212,3 +215,37 @@ LABLINKS_RESOURCE_DESCRIPTION = ( ...@@ -212,3 +215,37 @@ LABLINKS_RESOURCE_DESCRIPTION = (
"iPPI-DB : An interactive database of protein-protein interactions modulators" "iPPI-DB : An interactive database of protein-protein interactions modulators"
) )
LABLINKS_CONTACT_EMAIL = "ippidb@pasteur.fr" LABLINKS_CONTACT_EMAIL = "ippidb@pasteur.fr"
# MAINTENANCE SETTINGS
# if True the maintenance-mode will be activated
MAINTENANCE_MODE = None
# by default, to get/set the state value a local file backend is used
# if you want to use the db or cache, you can create a custom backend
# custom backends must extend 'maintenance_mode.backends.AbstractStateBackend' class
# and implement get_value(self) and set_value(self, val) methods
MAINTENANCE_MODE_STATE_BACKEND = "maintenance_mode.backends.LocalFileBackend"
# if True admin site will not be affected by the maintenance-mode page
MAINTENANCE_MODE_IGNORE_ADMIN_SITE = True
# if True anonymous users will not see the maintenance-mode page
MAINTENANCE_MODE_IGNORE_ANONYMOUS_USER = False
# if True authenticated users will not see the maintenance-mode page
MAINTENANCE_MODE_IGNORE_AUTHENTICATED_USER = False
# if True the staff will not see the maintenance-mode page
MAINTENANCE_MODE_IGNORE_STAFF = False
# if True the superuser will not see the maintenance-mode page
MAINTENANCE_MODE_IGNORE_SUPERUSER = False
# if True the maintenance mode will not return 503 response while running tests
# useful for running tests while maintenance mode is on, before opening the site to public use
MAINTENANCE_MODE_IGNORE_TESTS = False
# the template that will be shown by the maintenance-mode page
MAINTENANCE_MODE_TEMPLATE = "503.html"
# the path of the function that will return the template context -> 'myapp.mymodule.myfunction'
MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT = None
# the HTTP status code to send
MAINTENANCE_MODE_STATUS_CODE = 503
# the value in seconds of the Retry-After header during maintenance-mode
MAINTENANCE_MODE_RETRY_AFTER = 3600 # 1 hour
# list of urls that will not be affected by the maintenance-mode
# urls will be used to compile regular expressions objects
MAINTENANCE_MODE_IGNORE_URLS = (r"^((?!\/targetcentric).)*$",)
...@@ -62,6 +62,7 @@ INSTALLED_APPS = [ ...@@ -62,6 +62,7 @@ INSTALLED_APPS = [
"allauth.socialaccount.providers.orcid", "allauth.socialaccount.providers.orcid",
"rest_framework", "rest_framework",
"polymorphic", "polymorphic",
"maintenance_mode",
] ]
MIDDLEWARE = [ MIDDLEWARE = [
...@@ -74,6 +75,7 @@ MIDDLEWARE = [ ...@@ -74,6 +75,7 @@ MIDDLEWARE = [
"django.contrib.messages.middleware.MessageMiddleware", "django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware",
"debug_toolbar.middleware.DebugToolbarMiddleware", "debug_toolbar.middleware.DebugToolbarMiddleware",
"maintenance_mode.middleware.MaintenanceModeMiddleware",
] ]
ROOT_URLCONF = "ippisite.urls" ROOT_URLCONF = "ippisite.urls"
...@@ -92,6 +94,7 @@ TEMPLATES = [ ...@@ -92,6 +94,7 @@ TEMPLATES = [
"ippidb.views.marvinjs", "ippidb.views.marvinjs",
"ippidb.views.google_analytics", "ippidb.views.google_analytics",
"live_settings.context_processors.processors", "live_settings.context_processors.processors",
"maintenance_mode.context_processors.maintenance_mode",
] ]
}, },
} }
...@@ -190,3 +193,37 @@ LABLINKS_RESOURCE_DESCRIPTION = ( ...@@ -190,3 +193,37 @@ LABLINKS_RESOURCE_DESCRIPTION = (
"iPPI-DB : An interactive database of protein-protein interactions modulators" "iPPI-DB : An interactive database of protein-protein interactions modulators"
) )
LABLINKS_CONTACT_EMAIL = "ippidb@pasteur.fr" LABLINKS_CONTACT_EMAIL = "ippidb@pasteur.fr"
# MAINTENANCE SETTINGS
# if True the maintenance-mode will be activated
MAINTENANCE_MODE = None
# by default, to get/set the state value a local file backend is used
# if you want to use the db or cache, you can create a custom backend
# custom backends must extend 'maintenance_mode.backends.AbstractStateBackend' class
# and implement get_value(self) and set_value(self, val) methods
MAINTENANCE_MODE_STATE_BACKEND = "maintenance_mode.backends.LocalFileBackend"
# if True admin site will not be affected by the maintenance-mode page
MAINTENANCE_MODE_IGNORE_ADMIN_SITE = True
# if True anonymous users will not see the maintenance-mode page
MAINTENANCE_MODE_IGNORE_ANONYMOUS_USER = False
# if True authenticated users will not see the maintenance-mode page
MAINTENANCE_MODE_IGNORE_AUTHENTICATED_USER = False
# if True the staff will not see the maintenance-mode page
MAINTENANCE_MODE_IGNORE_STAFF = False
# if True the superuser will not see the maintenance-mode page
MAINTENANCE_MODE_IGNORE_SUPERUSER = False
# if True the maintenance mode will not return 503 response while running tests
# useful for running tests while maintenance mode is on, before opening the site to public use
MAINTENANCE_MODE_IGNORE_TESTS = False
# the template that will be shown by the maintenance-mode page
MAINTENANCE_MODE_TEMPLATE = "503.html"
# the path of the function that will return the template context -> 'myapp.mymodule.myfunction'
MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT = None
# the HTTP status code to send
MAINTENANCE_MODE_STATUS_CODE = 503
# the value in seconds of the Retry-After header during maintenance-mode
MAINTENANCE_MODE_RETRY_AFTER = 3600 # 1 hour
# list of urls that will not be affected by the maintenance-mode
# urls will be used to compile regular expressions objects
MAINTENANCE_MODE_IGNORE_URLS = (r"^((?!\/targetcentric).)*$",)
...@@ -15,6 +15,7 @@ Including another URLconf ...@@ -15,6 +15,7 @@ Including another URLconf
""" """
from django.conf.urls import include, url from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
from . import views
urlpatterns = [ urlpatterns = [
url(r"^", include("ippidb.urls")), url(r"^", include("ippidb.urls")),
...@@ -22,4 +23,6 @@ urlpatterns = [ ...@@ -22,4 +23,6 @@ urlpatterns = [
url(r"^admin/", admin.site.urls), url(r"^admin/", admin.site.urls),
url(r"^accounts/", include("allauth.urls")), url(r"^accounts/", include("allauth.urls")),
url(r"^auth/", include("django.contrib.auth.urls")), url(r"^auth/", include("django.contrib.auth.urls")),
url(r'^maintenance-mode/on/', views.maintenance_mode_on, name="maintenance_on"),
url(r'^maintenance-mode/off/', views.maintenance_mode_off, name="maintenance_off"),
] ]
{% extends "index.html" %}
{% block content %}
<div class="inner-wrap">
<div id="main-wrapper" class="page">
<div id="main">
<div id="content" class="main-content">
<div class="section">
<main role="main">
<h1 class="page-title"> {% block pagetitle %}We&rsquo;ll be back soon!{% endblock%} </h1>
<div class="tabs"></div>
<div class="main__inner">
<div class="region region-content">
<div class="page-intro">
</div>
<div class="color-wrap">
<div class="region region-content">
<div class="block block-system block-system-main">
<div class="content">
<div class="view-content">
{% block view_content %}
<p>Sorry for the inconvenience but we&rsquo;re performing some maintenance at the moment. We&rsquo;ll be back online shortly!</p>
<p>&mdash; The iPPI-DB Team</p>
{% endblock %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main><!-- .site-main -->
</div>
</div>
</div><!-- div main -->
</div>
</div>
{% endblock %}
...@@ -39,6 +39,24 @@ ...@@ -39,6 +39,24 @@
{%endif%} {%endif%}
</form> </form>
<hr/> <hr/>
{% if maintenance_mode %}
<form method="GET" action="/maintenance-mode/off/"
style="display:block">{% csrf_token %}
<span><b>Maintenance</b>: Activated</span>
<input type="hidden" name="value" value="False"/>
<input type="submit" value="Unactive maintenance mode"/>
</form>
{%else%}
<form method="GET" action="/maintenance-mode/on/"
style="display:block">{% csrf_token %}
<span><b>Maintenance</b>: Unactivated</span>
<input type="hidden" name="value" value="True"/>
<input type="submit" value="Active maintenance mode"/>
</form>
{%endif%}
</form>
<hr/>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment