#93 Errors via mail

* configures server errors sending via mail
   * default for now is always 'ksp-servicestelle'
* includes improvements from #97
pull/98/head
mpeltriaux 3 years ago
parent ff5d209895
commit f9751d38db

@ -32,6 +32,10 @@ SECRET_KEY = '5=9-)2)h$u9=!zrhia9=lj-2#cpcb8=#$7y+)l$5tto$3q(n_+'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
ADMINS = [
('KSP-Servicestelle', 'ksp-servicestelle@sgdnord.rlp.de'),
]
ALLOWED_HOSTS = [ ALLOWED_HOSTS = [
"127.0.0.1", "127.0.0.1",
"localhost", "localhost",
@ -207,10 +211,12 @@ DEBUG_TOOLBAR_CONFIG = {
# EMAIL (see https://docs.djangoproject.com/en/dev/topics/email/) # EMAIL (see https://docs.djangoproject.com/en/dev/topics/email/)
# CHANGE_ME !!! ONLY FOR DEVELOPMENT !!! # CHANGE_ME !!! ONLY FOR DEVELOPMENT !!!
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend' if DEBUG:
EMAIL_FILE_PATH = '/tmp/app-messages' # change this to a proper location EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = '/tmp/app-messages' # change this to a proper location
DEFAULT_FROM_EMAIL = "service@ksp.de" # The default email address for the 'from' element DEFAULT_FROM_EMAIL = "service@ksp.de" # The default email address for the 'from' element
SERVER_EMAIL = DEFAULT_FROM_EMAIL # The default email sender address, which is used by Django to send errors via mail
EMAIL_HOST = "localhost" EMAIL_HOST = "localhost"
EMAIL_REPLY_TO = "ksp-servicestelle@sgdnord.rlp.de" EMAIL_REPLY_TO = "ksp-servicestelle@sgdnord.rlp.de"
SUPPORT_MAIL_RECIPIENT = EMAIL_REPLY_TO SUPPORT_MAIL_RECIPIENT = EMAIL_REPLY_TO
@ -219,37 +225,3 @@ EMAIL_PORT = "25"
#EMAIL_HOST_PASSWORD = "" #EMAIL_HOST_PASSWORD = ""
EMAIL_USE_TLS = False EMAIL_USE_TLS = False
EMAIL_USE_SSL = False EMAIL_USE_SSL = False
# LOGGING
BASIC_LOGGER = "logger"
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '{levelname} {asctime} {module}: {message}',
'style': '{',
},
'simple': {
'format': '{levelname} {message}',
'style': '{',
},
},
'handlers': {
'log_to_file': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': '{}/logs/error.log'.format(BASE_DIR),
'maxBytes': 1024*1024*5, # 5 MB
'backupCount': 5,
'formatter': 'verbose',
},
},
'loggers': {
BASIC_LOGGER: {
'handlers': ['log_to_file'],
'level': 'INFO',
'propagate': True,
},
},
}

@ -5,16 +5,12 @@ Contact: michel.peltriaux@sgdnord.rlp.de
Created on: 09.11.20 Created on: 09.11.20
""" """
import logging
from django.core.mail import send_mail from django.core.mail import send_mail
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from konova.sub_settings.django_settings import DEFAULT_FROM_EMAIL, EMAIL_REPLY_TO, SUPPORT_MAIL_RECIPIENT from konova.sub_settings.django_settings import DEFAULT_FROM_EMAIL, EMAIL_REPLY_TO, SUPPORT_MAIL_RECIPIENT
logger = logging.getLogger(__name__)
class Mailer: class Mailer:
""" """

@ -9,7 +9,7 @@
<br> <br>
{% trans 'the following dataset has just been checked' %} {% trans 'the following dataset has just been checked' %}
<br> <br>
<strong>'{{obj_identifier}}'</strong> <strong>{{obj_identifier}}</strong>
<br> <br>
{% trans 'This means, the responsible registration office just confirmed the correctness of this dataset.' %} {% trans 'This means, the responsible registration office just confirmed the correctness of this dataset.' %}
<br> <br>

@ -9,7 +9,7 @@
<br> <br>
{% trans 'the following dataset has just been deleted' %} {% trans 'the following dataset has just been deleted' %}
<br> <br>
<strong>'{{obj_identifier}}'</strong> <strong>{{obj_identifier}}</strong>
<br> <br>
{% trans 'If this should not have been happened, please contact us. See the signature for details.' %} {% trans 'If this should not have been happened, please contact us. See the signature for details.' %}
<br> <br>

@ -9,7 +9,7 @@
<br> <br>
{% trans 'the following dataset has just been recorded' %} {% trans 'the following dataset has just been recorded' %}
<br> <br>
<strong>'{{obj_identifier}}'</strong> <strong>{{obj_identifier}}</strong>
<br> <br>
{% trans 'This means the data is now publicly available, e.g. in LANIS' %} {% trans 'This means the data is now publicly available, e.g. in LANIS' %}
<br> <br>

@ -9,7 +9,7 @@
<br> <br>
{% trans 'the following dataset has just been unrecorded' %} {% trans 'the following dataset has just been unrecorded' %}
<br> <br>
<strong>'{{obj_identifier}}'</strong> <strong>{{obj_identifier}}</strong>
<br> <br>
{% trans 'This means the data is no longer publicly available.' %} {% trans 'This means the data is no longer publicly available.' %}
<br> <br>

@ -9,7 +9,7 @@
<br> <br>
{% trans 'the following dataset has just been shared with you' %} {% trans 'the following dataset has just been shared with you' %}
<br> <br>
<strong>'{{obj_identifier}}'</strong> <strong>{{obj_identifier}}</strong>
<br> <br>
{% trans 'This means you can now edit this dataset.' %} {% trans 'This means you can now edit this dataset.' %}
{% trans 'The shared dataset appears now by default on your overview for this dataset type.' %} {% trans 'The shared dataset appears now by default on your overview for this dataset type.' %}

@ -9,7 +9,7 @@
<br> <br>
{% trans 'your shared access, including editing, has been revoked for the dataset ' %} {% trans 'your shared access, including editing, has been revoked for the dataset ' %}
<br> <br>
<strong>'{{obj_identifier}}'</strong> <strong>{{obj_identifier}}</strong>
<br> <br>
{% trans 'However, you are still able to view the dataset content.' %} {% trans 'However, you are still able to view the dataset content.' %}
{% trans 'Please use the provided search filter on the dataset`s overview pages to find them.' %} {% trans 'Please use the provided search filter on the dataset`s overview pages to find them.' %}

Loading…
Cancel
Save