settings: Make EMAIL_BACKEND more flexible.

This commit is contained in:
Brett Smith 2018-10-10 13:36:21 -04:00
parent 7a25022890
commit 1aa1daf3f6

View file

@ -286,8 +286,11 @@ FIXTURE_DIRS = [
# Heroku: Get email configuration from environment variables.
EMAIL_BACKEND = "email_log.backends.EmailBackend"
EMAIL_LOG_BACKEND = os.environ.get("DJANGO_EMAIL_BACKEND", "django.core.mail.backends.console.EmailBackend") # noqa
EMAIL_BACKEND = os.environ.get(
"DJANGO_EMAIL_BACKEND",
"django.core.mail.backends.{}.EmailBackend".format('console' if DEBUG else 'smtp'),
)
EMAIL_LOG_BACKEND = "email_log.backends.EmailBackend"
EMAIL_HOST = os.environ.get("DJANGO_EMAIL_HOST", "")
EMAIL_PORT = int(os.environ.get("DJANGO_EMAIL_PORT", 25))
EMAIL_HOST_USER = os.environ.get("DJANGO_EMAIL_HOST_USER", "")