55Automates copying the correct configuration files for different deployment scenarios.
66"""
77
8- import sys
98import shutil
9+ import sys
1010from pathlib import Path
1111
1212DEPLOYMENTS = {
1313 "local" : {
1414 "name" : "Local development with Uvicorn" ,
1515 "description" : "Auto-reload enabled, development-friendly" ,
16- "path" : "scripts/local_with_uvicorn"
16+ "path" : "scripts/local_with_uvicorn" ,
1717 },
1818 "staging" : {
1919 "name" : "Staging with Gunicorn managing Uvicorn workers" ,
2020 "description" : "Production-like setup for testing" ,
21- "path" : "scripts/gunicorn_managing_uvicorn_workers"
21+ "path" : "scripts/gunicorn_managing_uvicorn_workers" ,
2222 },
2323 "production" : {
2424 "name" : "Production with NGINX" ,
2525 "description" : "Full production setup with reverse proxy" ,
26- "path" : "scripts/production_with_nginx"
27- }
26+ "path" : "scripts/production_with_nginx" ,
27+ },
2828}
2929
30+
3031def show_help ():
3132 """Display help information"""
3233 print ("FastAPI Boilerplate Setup" )
@@ -44,6 +45,7 @@ def show_help():
4445 print (" python setup.py staging # Set up for staging environment" )
4546 print (" python setup.py production # Set up for production deployment" )
4647
48+
4749def copy_files (deployment_type : str ):
4850 """Copy configuration files for the specified deployment type"""
4951 if deployment_type not in DEPLOYMENTS :
@@ -66,7 +68,7 @@ def copy_files(deployment_type: str):
6668 files_to_copy = [
6769 ("Dockerfile" , "Dockerfile" ),
6870 ("docker-compose.yml" , "docker-compose.yml" ),
69- (".env.example" , "src/.env" )
71+ (".env.example" , "src/.env" ),
7072 ]
7173
7274 success = True
@@ -111,6 +113,7 @@ def copy_files(deployment_type: str):
111113
112114 return False
113115
116+
114117def interactive_setup ():
115118 """Interactive setup when no arguments provided"""
116119 print ("FastAPI Boilerplate Setup" )
@@ -147,6 +150,7 @@ def interactive_setup():
147150 print ("\n \n 👋 Setup cancelled." )
148151 return None
149152
153+
150154def main ():
151155 """Main entry point"""
152156 if len (sys .argv ) > 1 and sys .argv [1 ] in ["-h" , "--help" , "help" ]:
@@ -168,5 +172,6 @@ def main():
168172 if not success :
169173 sys .exit (1 )
170174
175+
171176if __name__ == "__main__" :
172177 main ()
0 commit comments