From 0621929cd2889892106d853a9a2cd3b0a491f73c Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Thu, 6 Feb 2020 18:41:30 -0500 Subject: [PATCH] Removed None option for mail service * This is necessary in order to be compatible with Django-allauth --- cookiecutter.json | 5 ++--- .../config/settings/production.py | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index ae0576b5..5e85af48 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -34,7 +34,7 @@ "None" ], "mail_service": [ - "{% if cookiecutter.cloud_provider == 'AWS' %}Amazon SES{% else %}None{% endif %}", + "{% if cookiecutter.cloud_provider == 'AWS' %}Amazon SES{% else %}Plain/Vanilla Django-Anymail{% endif %}", "Mailgun", "Mailjet", "Mandrill", @@ -42,8 +42,7 @@ "Sendgrid", "SendinBlue", "SparkPost", - "Plain/Vanilla Django-Anymail", - "None" + "Plain/Vanilla Django-Anymail" ], "use_drf": "n", "custom_bootstrap_compilation": "n", diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index e0af4c59..6d431800 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -188,59 +188,60 @@ ADMIN_URL = env("DJANGO_ADMIN_URL") INSTALLED_APPS += ["anymail"] # noqa F405 {%- if cookiecutter.mail_service == 'Amazon SES' %} EMAIL_BACKEND = "anymail.backends.amazon_ses.EmailBackend" -# https://anymail.readthedocs.io/en/stable/esps/amazon_ses/ {%- elif cookiecutter.mail_service == 'Mailgun' %} EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend" -# https://anymail.readthedocs.io/en/stable/esps/mailgun/ {%- elif cookiecutter.mail_service == 'Mailjet' %} EMAIL_BACKEND = "anymail.backends.mailjet.EmailBackend" -# https://anymail.readthedocs.io/en/stable/esps/mailjet/ {%- elif cookiecutter.mail_service == 'Mandrill' %} EMAIL_BACKEND = "anymail.backends.mandrill.EmailBackend" -# https://anymail.readthedocs.io/en/stable/esps/mandrill/ {%- elif cookiecutter.mail_service == 'Postmark' %} EMAIL_BACKEND = "anymail.backends.postmark.EmailBackend" -# https://anymail.readthedocs.io/en/stable/esps/postmark/ {%- elif cookiecutter.mail_service == 'Sendgrid' %} EMAIL_BACKEND = "anymail.backends.sendgrid.EmailBackend" -# https://anymail.readthedocs.io/en/stable/esps/sendgrid/ {%- elif cookiecutter.mail_service == 'SendinBlue' %} EMAIL_BACKEND = "anymail.backends.sendinblue.EmailBackend" -# https://anymail.readthedocs.io/en/stable/esps/sendinblue/ {%- elif cookiecutter.mail_service == 'SparkPost' %} EMAIL_BACKEND = "anymail.backends.sparkpost.EmailBackend" -# https://anymail.readthedocs.io/en/stable/esps/sparkpost/ {%- elif cookiecutter.mail_service == 'Plain/Vanilla Django-Anymail' %} EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" # https://docs.djangoproject.com/en/3.0/ref/settings/#email-backend {%- endif %} # https://anymail.readthedocs.io/en/stable/installation/#anymail-settings-reference ANYMAIL = { - {%- if cookiecutter.mail_service == 'Mailgun' %} + {%- if cookiecutter.mail_service == 'Amazon SES' %} + # https://anymail.readthedocs.io/en/stable/esps/amazon_ses/ + {%- elif cookiecutter.mail_service == 'Mailgun' %} "MAILGUN_API_KEY": env("MAILGUN_API_KEY"), "MAILGUN_SENDER_DOMAIN": env("MAILGUN_DOMAIN"), "MAILGUN_API_URL": env("MAILGUN_API_URL", default="https://api.mailgun.net/v3"), + # https://anymail.readthedocs.io/en/stable/esps/mailgun/ {%- elif cookiecutter.mail_service == 'Mailjet' %} "MAILJET_API_KEY": env("MAILJET_API_KEY"), "MAILJET_SECRET_KEY": env("MAILJET_SECRET_KEY"), "MAILJET_API_URL": env("MAILJET_API_URL", default="https://api.mailjet.com/v3"), + # https://anymail.readthedocs.io/en/stable/esps/mailjet/ {%- elif cookiecutter.mail_service == 'Mandrill' %} "MANDRILL_API_KEY": env("MANDRILL_API_KEY"), "MANDRILL_API_URL": env("MANDRILL_API_URL", default="https://mandrillapp.com/api/1.0"), + # https://anymail.readthedocs.io/en/stable/esps/mandrill/ {%- elif cookiecutter.mail_service == 'Postmark' %} "POSTMARK_SERVER_TOKEN": env("POSTMARK_SERVER_TOKEN"), "POSTMARK_API_URL": env("POSTMARK_API_URL", default="https://api.postmarkapp.com/"), + # https://anymail.readthedocs.io/en/stable/esps/postmark/ {%- elif cookiecutter.mail_service == 'Sendgrid' %} "SENDGRID_API_KEY": env("SENDGRID_API_KEY"), "SENDGRID_GENERATE_MESSAGE_ID": env("SENDGRID_GENERATE_MESSAGE_ID"), "SENDGRID_MERGE_FIELD_FORMAT": env("SENDGRID_MERGE_FIELD_FORMAT"), "SENDGRID_API_URL": env("SENDGRID_API_URL", default="https://api.sendgrid.com/v3/"), + # https://anymail.readthedocs.io/en/stable/esps/sendgrid/ {%- elif cookiecutter.mail_service == 'SendinBlue' %} "SENDINBLUE_API_KEY": env("SENDINBLUE_API_KEY"), "SENDINBLUE_API_URL": env("SENDINBLUE_API_URL", default="https://api.sendinblue.com/v3/"), + # https://anymail.readthedocs.io/en/stable/esps/sendinblue/ {%- elif cookiecutter.mail_service == 'SparkPost' %} "SPARKPOST_API_KEY": env("SPARKPOST_API_KEY"), "SPARKPOST_API_URL": env("SPARKPOST_API_URL", default="https://api.sparkpost.com/api/v1"), + # https://anymail.readthedocs.io/en/stable/esps/sparkpost/ {%- endif %} }