Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
744aec6a
Unverified
Commit
744aec6a
authored
5 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Implement maintenance mode. Closes
#51
.
parent
70e272e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!28
Implement maintenance mode. Closes #51.
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
biscuit/core/settings.py
+8
-0
8 additions, 0 deletions
biscuit/core/settings.py
biscuit/core/urls.py
+3
-1
3 additions, 1 deletion
biscuit/core/urls.py
biscuit/core/views.py
+3
-0
3 additions, 0 deletions
biscuit/core/views.py
pyproject.toml
+1
-0
1 addition, 0 deletions
pyproject.toml
with
15 additions
and
1 deletion
biscuit/core/settings.py
+
8
−
0
View file @
744aec6a
...
...
@@ -49,6 +49,7 @@ INSTALLED_APPS = [
'
fa
'
,
'
django_any_js
'
,
'
django_tables2
'
,
'
maintenance_mode
'
,
'
menu_generator
'
,
'
phonenumber_field
'
,
'
biscuit.core
'
...
...
@@ -81,6 +82,7 @@ MIDDLEWARE = [
'
django.contrib.messages.middleware.MessageMiddleware
'
,
'
django.middleware.clickjacking.XFrameOptionsMiddleware
'
,
'
easyaudit.middleware.easyaudit.EasyAuditMiddleware
'
,
'
maintenance_mode.middleware.MaintenanceModeMiddleware
'
,
]
ROOT_URLCONF
=
'
biscuit.core.urls
'
...
...
@@ -96,6 +98,7 @@ TEMPLATES = [
'
django.template.context_processors.request
'
,
'
django.contrib.auth.context_processors.auth
'
,
'
django.contrib.messages.context_processors.messages
'
,
'
maintenance_mode.context_processors.maintenance_mode
'
,
'
settings_context_processor.context_processors.settings
'
],
},
...
...
@@ -233,4 +236,9 @@ ADMINS = _settings.get('admins', [])
TEMPLATE_VISIBLE_SETTINGS
=
[
'
ADMINS
'
]
MAINTENANCE_MODE
=
_settings
.
get
(
'
maintenance.activate
'
,
'
None
'
)
MAINTENANCE_MODE_IGNORE_IP_ADDRESSES
=
_settings
.
get
(
'
maintenance.ignore_ip_addresses
'
,
())
MAINTENANCE_MODE_GET_CLIENT_IP_ADDRESS
=
'
ipware.ip.get_ip
'
MAINTENANCE_MODE_IGNORE_SUPERUSER
=
True
_settings
.
populate_obj
(
sys
.
modules
[
__name__
])
This diff is collapsed.
Click to expand it.
biscuit/core/urls.py
+
3
−
1
View file @
744aec6a
...
...
@@ -2,7 +2,7 @@ from django.apps import apps
from
django.conf
import
settings
from
django.conf.urls.static
import
static
from
django.contrib
import
admin
from
django.urls
import
include
,
path
from
django.urls
import
include
,
path
,
url
from
.
import
views
...
...
@@ -21,11 +21,13 @@ urlpatterns = [
path
(
'
group/<int:id_>
'
,
views
.
group
,
{
'
template
'
:
'
full
'
},
name
=
'
group_by_id
'
),
path
(
''
,
views
.
index
,
name
=
'
index
'
),
url
(
r
'
^maintenance-mode/
'
,
include
(
'
maintenance_mode.urls
'
)),
]
# Custom error pages
handler404
=
views
.
error_handler
(
404
)
handler500
=
views
.
error_handler
(
500
)
handler503
=
views
.
error_handler
(
503
)
# Serve javascript-common if in development
if
settings
.
DEBUG
:
...
...
This diff is collapsed.
Click to expand it.
biscuit/core/views.py
+
3
−
0
View file @
744aec6a
...
...
@@ -30,6 +30,9 @@ def error_handler(status: int) -> Callable[..., HttpResponse]:
elif
status
==
500
:
context
[
'
caption
'
]
=
_
(
'
Internal server error
'
)
context
[
'
message
'
]
=
_
(
'
An unexpected error has occurred.
'
)
elif
status
==
503
:
context
[
'
caption
'
]
=
_
(
'
Maintenance mode
'
)
context
[
'
message
'
]
=
_
(
'
The maintenance mode is currently enabled. Please try again later.
'
)
return
render
(
request
,
'
error.html
'
,
context
,
status
=
status
)
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
1
−
0
View file @
744aec6a
...
...
@@ -37,6 +37,7 @@ colour = "^0.1.5"
dynaconf
=
{
version
=
"^2.0"
,
extras
=
[
"yaml"
,
"toml"
,
"ini"
]}
django-settings-context-processor
=
"^0.2"
django-auth-ldap
=
{
version
=
"^2.0"
,
optional
=
true
}
django-maintenance-mode
=
"^0.13.3"
[tool.poetry.extras]
ldap
=
[
"django-auth-ldap"
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment