From 7ca4e195b0669b54f23020a3e54207793b8def22 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt <tarek@ring0.de> Date: Wed, 13 Dec 2023 21:49:16 +0100 Subject: [PATCH] netmon2/settings.py: add email settings Signed-off-by: Jan-Tarek Butt <tarek@ring0.de> --- netmon2/settings.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/netmon2/settings.py b/netmon2/settings.py index 47930d9..0070770 100644 --- a/netmon2/settings.py +++ b/netmon2/settings.py @@ -33,7 +33,7 @@ ALLOWED_HOSTS = [] INSTALLED_APPS = [ "crawler.apps.CrawlerConfig", - "django_celery_results", + 'django_celery_results', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -140,6 +140,10 @@ CELERY_BEAT_SCHEDULE = { 'cleanup_expired_entries': { 'task': 'crawler.tasks.cleanup_expired_entries', 'schedule': crontab(hour="*/24"), + }, + 'check_and_notify': { + 'task': 'netmon_core.tasks.check_and_notify', + 'schedule': crontab(minute="*/1"), } } @@ -152,3 +156,25 @@ AUTHENTICATION_BACKENDS = [ LOGIN_REDIRECT_URL = 'unmonitored_nodes' LOGIN_URL = 'login' # Adjust to match your login URL pattern name + +# Email configuration +EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +EMAIL_HOST = 'your-smtp-server.com' # Replace with your SMTP server +EMAIL_PORT = 587 # Replace with your SMTP server port +EMAIL_USE_TLS = True # Use TLS for secure connection + +# Replace with your SMTP server credentials +EMAIL_HOST_USER = 'your-smtp-username' +EMAIL_HOST_PASSWORD = 'your-smtp-password' + +# Default "from" address for emails sent by Django +DEFAULT_FROM_EMAIL = 'webmaster@example.com' +SERVER_EMAIL = 'webmaster@example.com' # Email address that error messages come from + +# Additional email settings (optional) +# EMAIL_SUBJECT_PREFIX = '[Your Subject Prefix] ' +# EMAIL_TIMEOUT = 5 # Set the timeout for the email sending process +# ... + +# Optional: If you want to use console email backend for development +# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' -- GitLab