mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-02-10 08:30:50 +03:00
Restore print statements in pre/post-generation hooks
This commit is contained in:
parent
304acaea72
commit
972a072b12
|
@ -284,6 +284,10 @@ def set_flag(file_path, flag, value=None, formatted=None, *args, **kwargs):
|
||||||
if value is None:
|
if value is None:
|
||||||
random_string = generate_random_string(*args, **kwargs)
|
random_string = generate_random_string(*args, **kwargs)
|
||||||
if random_string is None:
|
if random_string is None:
|
||||||
|
print(
|
||||||
|
"We couldn't find a secure pseudo-random number generator on your "
|
||||||
|
f"system. Please, make sure to manually {flag} later.",
|
||||||
|
)
|
||||||
random_string = flag
|
random_string = flag
|
||||||
if formatted is not None:
|
if formatted is not None:
|
||||||
random_string = formatted.format(random_string)
|
random_string = formatted.format(random_string)
|
||||||
|
@ -451,7 +455,11 @@ def main(): # noqa: C901, PLR0912, PLR0915
|
||||||
|
|
||||||
if "{{ cookiecutter.use_docker }}".lower() == "n" and "{{ cookiecutter.use_heroku }}".lower() == "n":
|
if "{{ cookiecutter.use_docker }}".lower() == "n" and "{{ cookiecutter.use_heroku }}".lower() == "n":
|
||||||
if "{{ cookiecutter.keep_local_envs_in_vcs }}".lower() == "y":
|
if "{{ cookiecutter.keep_local_envs_in_vcs }}".lower() == "y":
|
||||||
pass
|
print(
|
||||||
|
INFO + ".env(s) are only utilized when Docker Compose and/or "
|
||||||
|
"Heroku support is enabled so keeping them does not make sense "
|
||||||
|
"given your current setup." + TERMINATOR,
|
||||||
|
)
|
||||||
remove_envs_and_associated_files()
|
remove_envs_and_associated_files()
|
||||||
else:
|
else:
|
||||||
append_to_gitignore_file(".env")
|
append_to_gitignore_file(".env")
|
||||||
|
@ -475,7 +483,10 @@ def main(): # noqa: C901, PLR0912, PLR0915
|
||||||
)
|
)
|
||||||
|
|
||||||
if "{{ cookiecutter.cloud_provider }}" == "None" and "{{ cookiecutter.use_docker }}".lower() == "n": # noqa: PLR0133
|
if "{{ cookiecutter.cloud_provider }}" == "None" and "{{ cookiecutter.use_docker }}".lower() == "n": # noqa: PLR0133
|
||||||
pass
|
print(
|
||||||
|
WARNING + "You chose to not use any cloud providers nor Docker, "
|
||||||
|
"media files won't be served in production." + TERMINATOR,
|
||||||
|
)
|
||||||
|
|
||||||
if "{{ cookiecutter.use_celery }}".lower() == "n":
|
if "{{ cookiecutter.use_celery }}".lower() == "n":
|
||||||
remove_celery_files()
|
remove_celery_files()
|
||||||
|
@ -500,6 +511,8 @@ def main(): # noqa: C901, PLR0912, PLR0915
|
||||||
if "{{ cookiecutter.use_async }}".lower() == "n":
|
if "{{ cookiecutter.use_async }}".lower() == "n":
|
||||||
remove_async_files()
|
remove_async_files()
|
||||||
|
|
||||||
|
print(SUCCESS + "Project initialized, keep up the good work!" + TERMINATOR)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -23,7 +23,9 @@ assert project_slug == project_slug.lower(), f"'{project_slug}' project slug sho
|
||||||
assert "\\" not in "{{ cookiecutter.author_name }}", "Don't include backslashes in author name." # noqa: PLR0133
|
assert "\\" not in "{{ cookiecutter.author_name }}", "Don't include backslashes in author name." # noqa: PLR0133
|
||||||
|
|
||||||
if "{{ cookiecutter.use_whitenoise }}".lower() == "n" and "{{ cookiecutter.cloud_provider }}" == "None": # noqa: PLR0133
|
if "{{ cookiecutter.use_whitenoise }}".lower() == "n" and "{{ cookiecutter.cloud_provider }}" == "None": # noqa: PLR0133
|
||||||
|
print("You should either use Whitenoise or select a Cloud Provider to serve static files")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if "{{ cookiecutter.mail_service }}" == "Amazon SES" and "{{ cookiecutter.cloud_provider }}" != "AWS": # noqa: PLR0133
|
if "{{ cookiecutter.mail_service }}" == "Amazon SES" and "{{ cookiecutter.cloud_provider }}" != "AWS": # noqa: PLR0133
|
||||||
|
print("You should either use AWS or select a different Mail Service for sending emails.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -111,7 +111,6 @@ lint.select = [
|
||||||
"SLF",
|
"SLF",
|
||||||
"SLOT",
|
"SLOT",
|
||||||
"T10",
|
"T10",
|
||||||
"T20",
|
|
||||||
"TCH",
|
"TCH",
|
||||||
"TID",
|
"TID",
|
||||||
"TRY",
|
"TRY",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user