Use MailGun via django-anymail instead of Gandi

This commit is contained in:
Carl van Tonder 2018-04-03 17:46:04 -04:00
parent f4a7a108b5
commit ef54317bea
3 changed files with 15 additions and 7 deletions

View File

@ -66,8 +66,8 @@ WEBLATE_GITHUB_USERNAME=livmackintosh
#WEBLATE_REQUIRE_LOGIN=1
# Mail server, the server has to listen on port 587 and understand TLS
WEBLATE_EMAIL_HOST=mail.gandi.net
WEBLATE_EMAIL_HOST=smtp.mailgun.org
# Do NOT use quotes here
WEBLATE_EMAIL_USER=admin@ojuso.org
WEBLATE_EMAIL_USER=postmaster@mail.ojuso.org
# Do NOT use quotes here
WEBLATE_EMAIL_PASSWORD=${SMTP_PASSWORD}

View File

@ -66,6 +66,7 @@ INSTALLED_APPS = [
'rest_framework_gis',
'storages',
'whitenoise.runserver_nostatic',
'anymail',
]
MIDDLEWARE = [
@ -107,7 +108,7 @@ WSGI_APPLICATION = 'ojusomap.wsgi.application'
# E-Mail
# https://docs.djangoproject.com/en/1.11/topics/email/
ADMINS = [('Livvy','livvy@base.nu')]
ADMINS = [('Autonomic','autonomic-coop@posteo.net')]
DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL', 'webmaster@localhost')
EMAIL_HOST = os.getenv('EMAIL_HOST', 'localhost')
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD')
@ -117,6 +118,12 @@ EMAIL_USE_TLS = bool(int(os.getenv('EMAIL_USE_TLS', False)))
EMAIL_SUBJECT_PREFIX = "Ojuso Platform"
SERVER_EMAIL = os.getenv('SERVER_EMAIL', 'root@localhost')
EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend"
ANYMAIL = {
"MAILGUN_API_KEY": os.getenv("MAILGUN_API_KEY", ""),
"MAILGUN_SENDER_DOMAIN": os.getenv("MAILGUN_SENDER_DOMAIN", ""),
}
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
@ -204,17 +211,17 @@ MEDIA_URL = os.getenv("MEDIA_URL", "https://ojuso-media.nyc3.digitaloceanspaces.
# Cache
# https://docs.djangoproject.com/en/1.11/topics/cache/
if not DEBUG:
if DEBUG:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': 'cache:11211',
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
else:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': 'cache:11211',
}
}

View File

@ -4,6 +4,7 @@ boto==2.48.0
boto3==1.4.7
Django==1.11.6
django-appconf==1.0.2
django-anymail==2.0
django-avatar==4.0.1
django-bootstrap3==8.2.3
django-braces==1.11.0