mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-13 05:06:58 +03:00
Added unsupported mail_service combinations
* Added default yaml Loader for pre_gen_projects.py
This commit is contained in:
parent
b5f2e161f6
commit
484fa4ae77
|
@ -73,15 +73,15 @@ cloud_provider:
|
||||||
mail_service:
|
mail_service:
|
||||||
Select an email service that Django-Anymail provides
|
Select an email service that Django-Anymail provides
|
||||||
|
|
||||||
1. Amazon SES_
|
1. Mailgun_
|
||||||
2. Mailgun_
|
2. `Amazon SES`_
|
||||||
3. Mailjet_
|
3. Mailjet_
|
||||||
4. Mandrill_
|
4. Mandrill_
|
||||||
5. Postmark_
|
5. Postmark_
|
||||||
6. SendGrid_
|
6. SendGrid_
|
||||||
7. SendinBlue_
|
7. SendinBlue_
|
||||||
8. SparkPost_
|
8. SparkPost_
|
||||||
9. Plain/Vanilla Django-Anymail_
|
9. `Other SMTP`_
|
||||||
|
|
||||||
use_drf:
|
use_drf:
|
||||||
Indicates whether the project should be configured to use `Django Rest Framework`_.
|
Indicates whether the project should be configured to use `Django Rest Framework`_.
|
||||||
|
@ -114,8 +114,8 @@ ci_tool:
|
||||||
Select a CI tool for running tests. The choices are:
|
Select a CI tool for running tests. The choices are:
|
||||||
|
|
||||||
1. None
|
1. None
|
||||||
2. Travis_
|
2. `Travis CI`_
|
||||||
3. Gitlab_
|
3. `Gitlab CI`_
|
||||||
|
|
||||||
keep_local_envs_in_vcs:
|
keep_local_envs_in_vcs:
|
||||||
Indicates whether the project's ``.envs/.local/`` should be kept in VCS
|
Indicates whether the project's ``.envs/.local/`` should be kept in VCS
|
||||||
|
@ -145,7 +145,7 @@ debug:
|
||||||
.. _AWS: https://aws.amazon.com/s3/
|
.. _AWS: https://aws.amazon.com/s3/
|
||||||
.. _GCP: https://cloud.google.com/storage/
|
.. _GCP: https://cloud.google.com/storage/
|
||||||
|
|
||||||
.. _SES: https://aws.amazon.com/ses/
|
.. _Amazon SES: https://aws.amazon.com/ses/
|
||||||
.. _Mailgun: https://www.mailgun.com
|
.. _Mailgun: https://www.mailgun.com
|
||||||
.. _Mailjet: https://www.mailjet.com
|
.. _Mailjet: https://www.mailjet.com
|
||||||
.. _Mandrill: http://mandrill.com
|
.. _Mandrill: http://mandrill.com
|
||||||
|
@ -153,7 +153,7 @@ debug:
|
||||||
.. _SendGrid: https://sendgrid.com
|
.. _SendGrid: https://sendgrid.com
|
||||||
.. _SendinBlue: https://www.sendinblue.com
|
.. _SendinBlue: https://www.sendinblue.com
|
||||||
.. _SparkPost: https://www.sparkpost.com
|
.. _SparkPost: https://www.sparkpost.com
|
||||||
.. _Django-Anymail: https://anymail.readthedocs.io/en/stable/
|
.. _Other SMTP: https://anymail.readthedocs.io/en/stable/
|
||||||
|
|
||||||
.. _Django Rest Framework: https://github.com/encode/django-rest-framework/
|
.. _Django Rest Framework: https://github.com/encode/django-rest-framework/
|
||||||
|
|
||||||
|
|
|
@ -68,3 +68,15 @@ if (
|
||||||
"You should either use Whitenoise or select a Cloud Provider to serve static files"
|
"You should either use Whitenoise or select a Cloud Provider to serve static files"
|
||||||
)
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
if (
|
||||||
|
"{{ cookiecutter.cloud_provider }}" == "GCP"
|
||||||
|
and "{{ cookiecutter.mail_service }}" == "Amazon SES"
|
||||||
|
) or (
|
||||||
|
"{{ cookiecutter.cloud_provider }}" == "None"
|
||||||
|
and "{{ cookiecutter.mail_service }}" == "Amazon SES"
|
||||||
|
):
|
||||||
|
print(
|
||||||
|
"You should either use AWS or select a different Mail Service for sending emails."
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
|
@ -46,17 +46,33 @@ SUPPORTED_COMBINATIONS = [
|
||||||
{"cloud_provider": "AWS", "use_whitenoise": "n"},
|
{"cloud_provider": "AWS", "use_whitenoise": "n"},
|
||||||
{"cloud_provider": "GCP", "use_whitenoise": "y"},
|
{"cloud_provider": "GCP", "use_whitenoise": "y"},
|
||||||
{"cloud_provider": "GCP", "use_whitenoise": "n"},
|
{"cloud_provider": "GCP", "use_whitenoise": "n"},
|
||||||
{"cloud_provider": "None", "use_whitenoise": "y"},
|
{"cloud_provider": "None", "use_whitenoise": "y", "mail_service": "Mailgun"},
|
||||||
|
{"cloud_provider": "None", "use_whitenoise": "y", "mail_service": "Mailjet"},
|
||||||
|
{"cloud_provider": "None", "use_whitenoise": "y", "mail_service": "Mandrill"},
|
||||||
|
{"cloud_provider": "None", "use_whitenoise": "y", "mail_service": "Postmark"},
|
||||||
|
{"cloud_provider": "None", "use_whitenoise": "y", "mail_service": "Sendgrid"},
|
||||||
|
{"cloud_provider": "None", "use_whitenoise": "y", "mail_service": "SendinBlue"},
|
||||||
|
{"cloud_provider": "None", "use_whitenoise": "y", "mail_service": "SparkPost"},
|
||||||
|
{"cloud_provider": "None", "use_whitenoise": "y", "mail_service": "Other SMTP"},
|
||||||
# Note: cloud_provider=None AND use_whitenoise=n is not supported
|
# Note: cloud_provider=None AND use_whitenoise=n is not supported
|
||||||
{"mail_service": "Mailgun"},
|
{"cloud_provider": "AWS", "mail_service": "Mailgun"},
|
||||||
{"mail_service": "Amazon SES"},
|
{"cloud_provider": "AWS", "mail_service": "Amazon SES"},
|
||||||
{"mail_service": "Mailjet"},
|
{"cloud_provider": "AWS", "mail_service": "Mailjet"},
|
||||||
{"mail_service": "Mandrill"},
|
{"cloud_provider": "AWS", "mail_service": "Mandrill"},
|
||||||
{"mail_service": "Postmark"},
|
{"cloud_provider": "AWS", "mail_service": "Postmark"},
|
||||||
{"mail_service": "Sendgrid"},
|
{"cloud_provider": "AWS", "mail_service": "Sendgrid"},
|
||||||
{"mail_service": "SendinBlue"},
|
{"cloud_provider": "AWS", "mail_service": "SendinBlue"},
|
||||||
{"mail_service": "SparkPost"},
|
{"cloud_provider": "AWS", "mail_service": "SparkPost"},
|
||||||
{"mail_service": "Other SMTP"},
|
{"cloud_provider": "AWS", "mail_service": "Other SMTP"},
|
||||||
|
{"cloud_provider": "GCP", "mail_service": "Mailgun"},
|
||||||
|
{"cloud_provider": "GCP", "mail_service": "Mailjet"},
|
||||||
|
{"cloud_provider": "GCP", "mail_service": "Mandrill"},
|
||||||
|
{"cloud_provider": "GCP", "mail_service": "Postmark"},
|
||||||
|
{"cloud_provider": "GCP", "mail_service": "Sendgrid"},
|
||||||
|
{"cloud_provider": "GCP", "mail_service": "SendinBlue"},
|
||||||
|
{"cloud_provider": "GCP", "mail_service": "SparkPost"},
|
||||||
|
{"cloud_provider": "GCP", "mail_service": "Other SMTP"},
|
||||||
|
# Note: cloud_providers GCP and None with mail_service Amazon SES is not supported
|
||||||
{"use_drf": "y"},
|
{"use_drf": "y"},
|
||||||
{"use_drf": "n"},
|
{"use_drf": "n"},
|
||||||
{"js_task_runner": "None"},
|
{"js_task_runner": "None"},
|
||||||
|
@ -86,6 +102,8 @@ SUPPORTED_COMBINATIONS = [
|
||||||
|
|
||||||
UNSUPPORTED_COMBINATIONS = [
|
UNSUPPORTED_COMBINATIONS = [
|
||||||
{"cloud_provider": "None", "use_whitenoise": "n"},
|
{"cloud_provider": "None", "use_whitenoise": "n"},
|
||||||
|
{"cloud_provider": "GCP", "mail_service": "Amazon SES"},
|
||||||
|
{"cloud_provider": "None", "mail_service": "Amazon SES"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,7 +181,7 @@ def test_travis_invokes_pytest(cookies, context):
|
||||||
|
|
||||||
with open(f"{result.project}/.travis.yml", "r") as travis_yml:
|
with open(f"{result.project}/.travis.yml", "r") as travis_yml:
|
||||||
try:
|
try:
|
||||||
assert yaml.load(travis_yml)["script"] == ["pytest"]
|
assert yaml.load(travis_yml, Loader=yaml.FullLoader)["script"] == ["pytest"]
|
||||||
except yaml.YAMLError as e:
|
except yaml.YAMLError as e:
|
||||||
pytest.fail(e)
|
pytest.fail(e)
|
||||||
|
|
||||||
|
@ -179,7 +197,7 @@ def test_gitlab_invokes_flake8_and_pytest(cookies, context):
|
||||||
|
|
||||||
with open(f"{result.project}/.gitlab-ci.yml", "r") as gitlab_yml:
|
with open(f"{result.project}/.gitlab-ci.yml", "r") as gitlab_yml:
|
||||||
try:
|
try:
|
||||||
gitlab_config = yaml.load(gitlab_yml)
|
gitlab_config = yaml.load(gitlab_yml, Loader=yaml.FullLoader)
|
||||||
assert gitlab_config["flake8"]["script"] == ["flake8"]
|
assert gitlab_config["flake8"]["script"] == ["flake8"]
|
||||||
assert gitlab_config["pytest"]["script"] == ["pytest"]
|
assert gitlab_config["pytest"]["script"] == ["pytest"]
|
||||||
except yaml.YAMLError as e:
|
except yaml.YAMLError as e:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user