Skip to content

Commit

Permalink
Installed/configured django-maintenance-mode (for #22)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Noé committed Dec 7, 2021
1 parent 7a5d13a commit ccedb5e
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,12 @@ def my_view(request):
return redirect("dashboard:page-index")
```

## Maintenance mode

We make use of [django-maintenance-mode](https://github.com/fabiocaccamo/django-maintenance-mode).

Maintenance mode will be set during each occurrence data import (data would be inconsistent at this stage, so we don't
want to let users access the website, nor send e-mail notifications).

This tool can also be used to manually activate maintenance mode during complex maintenance tasks, look at
[django-maintenance-mode documentation](https://github.com/fabiocaccamo/django-maintenance-mode).
18 changes: 18 additions & 0 deletions dashboard/templates/503.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends 'dashboard/base.html' %}

{% load static %}

{% block page_title %}Maintenance - RIPARIAS early alert{% endblock %}

{% block after_messages %}
<div class="container">
<div class="row">
<div class="col">
<h1>The website is currently down for maintenance</h1>
<p>We expect to be back in a couple of minutes. Thanks for your patience.</p>
</div>
</div>
</div>

<script src="{% static 'js/index-bundle.js' %}"></script>
{% endblock after_messages %}
2 changes: 2 additions & 0 deletions djangoproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"django.contrib.gis",
"django.contrib.humanize",
# Third-party
"maintenance_mode",
"crispy_forms",
"crispy_bootstrap5",
# Local/custom
Expand All @@ -54,6 +55,7 @@
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django.middleware.locale.LocaleMiddleware",
"maintenance_mode.middleware.MaintenanceModeMiddleware",
]

ROOT_URLCONF = "djangoproject.urls"
Expand Down
14 changes: 13 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ selenium = "^3.141.0"
webdriver-manager = "^3.4.2"
django-crispy-forms = "^1.13.0"
crispy-bootstrap5 = "^0.6"
django-maintenance-mode = "^0.16.1"

[tool.poetry.dev-dependencies]
black = "^21.8b0"
Expand Down

0 comments on commit ccedb5e

Please sign in to comment.