Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iPPIDB
ippidb-web
Commits
5312f8d7
Commit
5312f8d7
authored
Jan 29, 2021
by
Fabien MAREUIL
Browse files
maintenance page
parent
a08065e9
Pipeline
#46840
failed with stages
in 8 minutes
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ippisite/ippisite/settings.py
View file @
5312f8d7
...
...
@@ -60,6 +60,7 @@ INSTALLED_APPS = [
"rest_framework"
,
"polymorphic"
,
"biodblinks"
,
"maintenance_mode"
,
]
MIDDLEWARE
=
[
...
...
@@ -73,6 +74,7 @@ MIDDLEWARE = [
"django.contrib.messages.middleware.MessageMiddleware"
,
"django.middleware.clickjacking.XFrameOptionsMiddleware"
,
"debug_toolbar.middleware.DebugToolbarMiddleware"
,
"maintenance_mode.middleware.MaintenanceModeMiddleware"
,
]
ROOT_URLCONF
=
"ippisite.urls"
...
...
@@ -91,6 +93,7 @@ TEMPLATES = [
"ippidb.views.marvinjs"
,
"ippidb.views.google_analytics"
,
"live_settings.context_processors.processors"
,
"maintenance_mode.context_processors.maintenance_mode"
,
]
},
}
...
...
@@ -212,3 +215,37 @@ LABLINKS_RESOURCE_DESCRIPTION = (
"iPPI-DB : An interactive database of protein-protein interactions modulators"
)
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).)*$"
,)
ippisite/ippisite/settings.template.py
View file @
5312f8d7
...
...
@@ -62,6 +62,7 @@ INSTALLED_APPS = [
"allauth.socialaccount.providers.orcid"
,
"rest_framework"
,
"polymorphic"
,
"maintenance_mode"
,
]
MIDDLEWARE
=
[
...
...
@@ -74,6 +75,7 @@ MIDDLEWARE = [
"django.contrib.messages.middleware.MessageMiddleware"
,
"django.middleware.clickjacking.XFrameOptionsMiddleware"
,
"debug_toolbar.middleware.DebugToolbarMiddleware"
,
"maintenance_mode.middleware.MaintenanceModeMiddleware"
,
]
ROOT_URLCONF
=
"ippisite.urls"
...
...
@@ -92,6 +94,7 @@ TEMPLATES = [
"ippidb.views.marvinjs"
,
"ippidb.views.google_analytics"
,
"live_settings.context_processors.processors"
,
"maintenance_mode.context_processors.maintenance_mode"
,
]
},
}
...
...
@@ -190,3 +193,37 @@ LABLINKS_RESOURCE_DESCRIPTION = (
"iPPI-DB : An interactive database of protein-protein interactions modulators"
)
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).)*$"
,)
ippisite/ippisite/urls.py
View file @
5312f8d7
...
...
@@ -15,6 +15,7 @@ Including another URLconf
"""
from
django.conf.urls
import
include
,
url
from
django.contrib
import
admin
from
.
import
views
urlpatterns
=
[
url
(
r
"^"
,
include
(
"ippidb.urls"
)),
...
...
@@ -22,4 +23,6 @@ urlpatterns = [
url
(
r
"^admin/"
,
admin
.
site
.
urls
),
url
(
r
"^accounts/"
,
include
(
"allauth.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"
),
]
ippisite/templates/503.html
0 → 100644
View file @
5312f8d7
{% 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
’
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
’
re performing some maintenance at the moment. We
’
ll be back online shortly!
</p>
<p>
—
The iPPI-DB Team
</p>
{% endblock %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<!-- .site-main -->
</div>
</div>
</div>
<!-- div main -->
</div>
</div>
{% endblock %}
ippisite/templates/admin/index.html
View file @
5312f8d7
...
...
@@ -39,6 +39,24 @@
{%endif%}
</form>
<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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment