Commit 16573d31 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB

Implement django-ses email backend for AWS deployment

parent 49f182bb
......@@ -95,6 +95,8 @@ RUN DJANGO_SETTINGS_MODULE=${SETTINGS_MODULE} \
LVALERT_OVERSEER_PORT=2 \
DJANGO_TWILIO_ACCOUNT_SID=fake_sid \
DJANGO_TWILIO_AUTH_TOKEN=fake_token \
AWS_SES_ACCESS_KEY_ID=fake_aws_id \
AWS_SES_SECRET_ACCESS_KEY=fake_aws_key \
python manage.py collectstatic --noinput
RUN rm -rf /app/logs/* /app/project_data/*
......
......@@ -337,6 +337,7 @@ SITE_ID=1
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.admin',
'django_ses',
'django.contrib.contenttypes',
'user_sessions',
'django.contrib.sites',
......
......@@ -62,15 +62,15 @@ if TWILIO_AUTH_TOKEN is None:
raise ImproperlyConfigured('Could not get Twilio auth token from envvars.')
# Get email settings from environment
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST = os.environ.get('SMTP_HOST', 'localhost')
EMAIL_HOST_USER = os.environ.get('SMTP_USERNAME', '')
EMAIL_HOST_PASSWORD = os.environ.get('SMTP_PASSWORD', '')
ALERT_EMAIL_FROM = os.environ.get('DJANGO_ALERT_EMAIL_FROM', None)
if ALERT_EMAIL_FROM is None:
raise ImproperlyConfigured(
"Could not get 'alert from email' from envvars.")
EMAIL_BACKEND = 'django_ses.SESBackend'
AWS_SES_ACCESS_KEY_ID = get_from_env('AWS_SES_ACCESS_KEY_ID')
AWS_SES_SECRET_ACCESS_KEY = get_from_env('AWS_SES_SECRET_ACCESS_KEY')
AWS_SES_REGION_NAME = get_from_env('AWS_SES_REGION_NAME',
default_value='us-west-2', fail_if_not_found=False)
AWS_SES_REGION_ENDPOINT = get_from_env('AWS_SES_REGION_ENDPOINT',
default_value='email.us-west-2.amazonaws.com', fail_if_not_found=False)
ALERT_EMAIL_FROM = get_from_env('DJANGO_ALERT_EMAIL_FROM')
# Database settings -----------------------------------------------------------
DATABASES = {
......
......@@ -4,6 +4,7 @@ django-debug-toolbar==1.9.1
django-extensions==2.0.5
django-guardian==1.4.9
django-model-utils==3.1.1
django-ses
django-silk==3.0.1
django-twilio==0.9.0
django-user-sessions==1.6.0
......@@ -35,3 +36,4 @@ twilio==6.10.3
# https://github.com/etingof/pyasn1/issues/112
pyasn1==0.3.6
pyasn1-modules==0.1.5
pytz==2018.9
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment