Skip to content

Commit 2984b46

Browse files
committed
fix post_gen_project hook
1 parent 064fdd2 commit 2984b46

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

hooks/post_gen_project.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from shutil import copytree, rmtree
99

1010
PROJECT_NAME = "{{ cookiecutter.project_name }}"
11-
USE_FASTAPI_USERS = bool("{{ cookiecutter.use_fastapi_users }}")
11+
USE_FASTAPI_USERS = "{{ cookiecutter.use_fastapi_users }}"
1212
TEMPLATES = ["template_fastapi_users", "template_minimal"]
1313

1414

@@ -31,10 +31,14 @@ def create_env_file_and_remove_env_template():
3131

3232

3333
if __name__ == "__main__":
34-
if USE_FASTAPI_USERS:
34+
truthy = ["T", "t", "true", "True", 1]
35+
falsy = ["F", "f", "false", "False", 0]
36+
if USE_FASTAPI_USERS in truthy:
3537
used_template = "template_fastapi_users"
36-
else:
38+
elif USE_FASTAPI_USERS in falsy:
3739
used_template = "template_minimal"
40+
else:
41+
raise ValueError(f"use_fastapi_users param must be in {truthy + falsy}")
3842

3943
copy_choosen_template_to_main_dir(used_template=used_template)
4044
create_env_file_and_remove_env_template()

0 commit comments

Comments
 (0)