Envoi d'un email à chaque erreur 500

Fix #269
This commit is contained in:
Jean-Marie Favreau 2025-01-12 17:16:14 +01:00
parent 6e897cf516
commit f9205481a8
3 changed files with 237 additions and 225 deletions

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,8 @@ else:
ADMINS = [tuple(a.split(',')) for a in os_getenv("ADMINS", "").split(";")]
MANAGERS = [tuple(a.split(',')) for a in os_getenv("MANAGERS", "").split(";")]
SERVER_EMAIL = os_getenv("SERVER_EMAIL", "")
# Application definition

View File

@ -15,6 +15,7 @@ from honeypot.decorators import check_honeypot
from .utils import PlaceGuesser
import hashlib
from django.core.cache import cache
from django.core.mail import mail_admins
from django.contrib.gis.geos import Point
@ -171,6 +172,8 @@ def page_not_found(request, exception=None):
def internal_server_error(request):
mail_admins(request.site.name + _(": error 500"),
_("An internal error has occurred on site {} at address {}.").format(request.site.name, request.build_absolute_uri()))
return render(request, "page-erreur.html", status=500, context={"error": 500})
def thank_you(request):