2018-03-08 15:56:15 +03:00
|
|
|
import sys
|
|
|
|
|
|
|
|
TERMINATOR = "\x1b[0m"
|
|
|
|
WARNING = "\x1b[1;33m [WARNING]: "
|
|
|
|
INFO = "\x1b[1;33m [INFO]: "
|
|
|
|
HINT = "\x1b[3;33m"
|
|
|
|
SUCCESS = "\x1b[1;32m [SUCCESS]: "
|
2016-04-26 00:09:37 +03:00
|
|
|
|
2023-03-16 20:17:02 +03:00
|
|
|
# The content of this string is evaluated by Jinja, and plays an important role.
|
|
|
|
# It updates the cookiecutter context to trim leading and trailing spaces
|
|
|
|
# from domain/email values
|
|
|
|
"""
|
|
|
|
{{ cookiecutter.update({ "domain_name": cookiecutter.domain_name | trim }) }}
|
|
|
|
{{ cookiecutter.update({ "email": cookiecutter.email | trim }) }}
|
|
|
|
"""
|
|
|
|
|
2018-04-09 01:03:29 +03:00
|
|
|
project_slug = "{{ cookiecutter.project_slug }}"
|
|
|
|
if hasattr(project_slug, "isidentifier"):
|
2023-04-15 17:43:04 +03:00
|
|
|
assert project_slug.isidentifier(), "'{}' project slug is not a valid Python identifier.".format(project_slug)
|
2016-06-04 02:35:10 +03:00
|
|
|
|
2023-04-15 17:43:04 +03:00
|
|
|
assert project_slug == project_slug.lower(), "'{}' project slug should be all lowercase".format(project_slug)
|
2019-06-05 21:00:43 +03:00
|
|
|
|
2023-04-15 17:43:04 +03:00
|
|
|
assert "\\" not in "{{ cookiecutter.author_name }}", "Don't include backslashes in author name."
|
2018-02-22 02:54:03 +03:00
|
|
|
|
2023-04-15 17:43:04 +03:00
|
|
|
if "{{ cookiecutter.use_whitenoise }}".lower() == "n" and "{{ cookiecutter.cloud_provider }}" == "None":
|
2024-12-31 15:58:13 +03:00
|
|
|
print("You should either use Whitenoise or select a Cloud Provider to serve static files")
|
2019-10-02 18:03:33 +03:00
|
|
|
sys.exit(1)
|
2020-03-22 20:31:52 +03:00
|
|
|
|
2023-04-15 17:43:04 +03:00
|
|
|
if "{{ cookiecutter.mail_service }}" == "Amazon SES" and "{{ cookiecutter.cloud_provider }}" != "AWS":
|
2024-12-31 15:58:13 +03:00
|
|
|
print("You should either use AWS or select a different Mail Service for sending emails.")
|
2020-03-22 20:31:52 +03:00
|
|
|
sys.exit(1)
|