Configurations and Packages added

* Production settings updated for all
* Added env vars from production settings
* Added packages requirements.txt
This commit is contained in:
Andrew-Chen-Wang 2020-02-06 16:58:15 -05:00
parent 575dead7cb
commit c8eb5462eb
3 changed files with 87 additions and 2 deletions

View File

@ -13,9 +13,26 @@ DJANGO_SECURE_SSL_REDIRECT=False
# Email
# ------------------------------------------------------------------------------
MAILGUN_API_KEY=
DJANGO_SERVER_EMAIL=
{% if cookiecutter.mail_service == 'Mailgun' %}
MAILGUN_API_KEY=
MAILGUN_DOMAIN=
{% elif cookiecutter.mail_service == 'Mailjet' %}
MAILJET_API_KEY=
MAILJET_SECRET_KEY=
{% elif cookiecutter.mail_service == 'Mandrill' %}
MANDRILL_API_KEY=
{% elif cookiecutter.mail_service == 'Postmark' %}
POSTMARK_SERVER_TOKEN=
{% elif cookiecutter.mail_service == 'Sendgrid' %}
SENDGRID_API_KEY=
SENDGRID_GENERATE_MESSAGE_ID=True
SENDGRID_MERGE_FIELD_FORMAT=None
{% elif cookiecutter.mail_service == 'SendinBlue' %}
SENDINBLUE_API_KEY=
{% elif cookiecutter.mail_service == 'SparkPost' %}
SPARKPOST_API_KEY=
{% endif %}
{% if cookiecutter.cloud_provider == 'AWS' %}
# AWS
# ------------------------------------------------------------------------------

View File

@ -182,16 +182,66 @@ EMAIL_SUBJECT_PREFIX = env(
# Django Admin URL regex.
ADMIN_URL = env("DJANGO_ADMIN_URL")
# Anymail (Mailgun)
# Anymail
# ------------------------------------------------------------------------------
# https://anymail.readthedocs.io/en/stable/installation/#installing-anymail
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' %}
"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"),
{%- 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"),
{%- 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"),
{%- elif cookiecutter.mail_service == 'Postmark' %}
"POSTMARK_SERVER_TOKEN": env("POSTMARK_SERVER_TOKEN"),
"POSTMARK_API_URL": env("POSTMARK_API_URL", default="https://api.postmarkapp.com/"),
{%- 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/"),
{%- 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/"),
{%- 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"),
{%- endif %}
}
{% if cookiecutter.use_compressor == 'y' -%}

View File

@ -18,4 +18,22 @@ django-storages[boto3]==1.9.1 # https://github.com/jschneier/django-storages
{%- elif cookiecutter.cloud_provider == 'GCP' %}
django-storages[google]==1.9.1 # https://github.com/jschneier/django-storages
{%- endif %}
{%- if cookiecutter.mail_service == 'Amazon SES' %}
django-anymail[amazon_ses]==7.0.0 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'Mailgun' %}
django-anymail[mailgun]==7.0.0 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'Mailjet' %}
django-anymail[mailjet]==7.0.0 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'Mandrill' %}
django-anymail[mandrill]==7.0.0 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'Postmark' %}
django-anymail[postmark]==7.0.0 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'Sendgrid' %}
django-anymail[sendgrid]==7.0.0 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'SendinBlue' %}
django-anymail[sendinblue]==7.0.0 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'SparkPost' %}
django-anymail[sparkpost]==7.0.0 # https://github.com/anymail/django-anymail
{%- elif cookiecutter.mail_service == 'Plain/Vanilla Django-Anymail' %}
django-anymail==7.0.0 # https://github.com/anymail/django-anymail
{%- endif %}