|
7 | 7 | import inflect
|
8 | 8 | from termcolor import cprint
|
9 | 9 |
|
| 10 | +from .enums import Templates |
| 11 | + |
10 | 12 |
|
11 | 13 | def raise_error_message(error_text: str, exception: Exception):
|
12 | 14 | raise exception(error_text)
|
@@ -97,3 +99,41 @@ def pluralize(string):
|
97 | 99 | """
|
98 | 100 | pluralizer = inflect.engine()
|
99 | 101 | return pluralizer.plural(string)
|
| 102 | + |
| 103 | + |
| 104 | +def display_project_setup_instructions( |
| 105 | + template_type: str, |
| 106 | +) -> None: |
| 107 | + if Templates.BASIC.value in template_type: |
| 108 | + print_info_message( |
| 109 | + "Project Run Steps:Run the following commands\n\n" |
| 110 | + """pip install -r requirements.txt |
| 111 | + NB: Skip the above command if dr-cli already installed dependencies \n""" |
| 112 | + "python manage.py migrate \n" |
| 113 | + "python manage.py runserver \n" |
| 114 | + "point your browser to `http://localhost:8000/api/v1/docs to view docs \n" |
| 115 | + ) |
| 116 | + |
| 117 | + if Templates.MEDIOR.value in template_type: |
| 118 | + print_info_message( |
| 119 | + "Project Run Steps: Run the following commands:\n\n" |
| 120 | + """pip install -r requirements.txt |
| 121 | + Then runpip install -r requirements-dev.txt |
| 122 | + NB: Skip the above commands if dr-cli already installed dependencies \n""" |
| 123 | + "pre-commit install \n" |
| 124 | + "python manage.py makemigrations users \n" |
| 125 | + "python manage.py migrate \n" |
| 126 | + "python manage.py runserver \n" |
| 127 | + "Point your browser to http://localhost:8000/api/v1/docs to view docs \n" |
| 128 | + ) |
| 129 | + |
| 130 | + if Templates.ADV.value in template_type: |
| 131 | + print_info_message( |
| 132 | + "Project Run Steps: Run the following commands\n\n" |
| 133 | + "pre-commit install \n" |
| 134 | + "docker-compose up --build \n" |
| 135 | + "Navigate to your project directory in a new terminal and run:\n\n" |
| 136 | + "docker-compose exec web python manage.py makemigrations users \n" |
| 137 | + "docker-compose exec web python manage.py migrate \n" |
| 138 | + "Point your browser to http://localhost:8000/api/v1/docs to view docs \n" |
| 139 | + ) |
0 commit comments