1919import shutil
2020import sys
2121from pathlib import Path
22- from typing import Optional
2322
2423EXCLUDE_PATTERNS = (
2524 "setup_project.py" ,
@@ -64,7 +63,9 @@ def load_config() -> dict:
6463 return config
6564
6665
67- def prompt (label : str , default : str = "" , required : bool = False , secret : bool = False ) -> str :
66+ def prompt (
67+ label : str , default : str = "" , required : bool = False , secret : bool = False
68+ ) -> str :
6869 """Prompt user for input with optional default value."""
6970 if default :
7071 display = f"{ label } [{ default } ]: "
@@ -74,6 +75,7 @@ def prompt(label: str, default: str = "", required: bool = False, secret: bool =
7475 while True :
7576 if secret :
7677 import getpass
78+
7779 value = getpass .getpass (display )
7880 else :
7981 value = input (display ).strip ()
@@ -111,7 +113,9 @@ def interactive_wizard() -> dict:
111113 prompt_section ("Project Information" )
112114 config ["project" ] = {
113115 "name" : prompt ("Project name (display name)" , "My App" , required = True ),
114- "name_slug" : prompt ("Project slug (lowercase, hyphens)" , "my-app-web" , required = True ),
116+ "name_slug" : prompt (
117+ "Project slug (lowercase, hyphens)" , "my-app-web" , required = True
118+ ),
115119 }
116120
117121 # Branding
@@ -150,16 +154,22 @@ def interactive_wizard() -> dict:
150154 "account_id" : prompt ("AWS Account ID" , "" , required = True ),
151155 "region" : prompt ("AWS Region" , "us-west-2" , required = True ),
152156 "access_key_id" : prompt ("AWS Access Key ID (for backups)" , "" ),
153- "secret_access_key" : prompt ("AWS Secret Access Key (for backups)" , "" , secret = True ),
157+ "secret_access_key" : prompt (
158+ "AWS Secret Access Key (for backups)" , "" , secret = True
159+ ),
154160 }
155161
156162 # Database
157163 prompt_section ("Database" )
158164 config ["database" ] = {
159165 "name" : prompt ("Database name" , "appdb" , required = True ),
160166 "user" : prompt ("Database user" , "appuser" , required = True ),
161- "password" : prompt ("Database password" , "change_me_secure_password" , required = True ),
162- "redis_password" : prompt ("Redis password" , "change_me_redis_password" , required = True ),
167+ "password" : prompt (
168+ "Database password" , "change_me_secure_password" , required = True
169+ ),
170+ "redis_password" : prompt (
171+ "Redis password" , "change_me_redis_password" , required = True
172+ ),
163173 }
164174
165175 # Deployment
@@ -272,20 +282,26 @@ def build_replacements(config: dict) -> dict[str, str]:
272282 # Django
273283 "{{DJANGO_SECRET_KEY}}" : generate_secret_key (),
274284 # Stripe
275- "{{STRIPE_PUBLISHABLE_KEY}}" : config .get ("stripe" , {}).get ("publishable_key" , "" ),
285+ "{{STRIPE_PUBLISHABLE_KEY}}" : config .get ("stripe" , {}).get (
286+ "publishable_key" , ""
287+ ),
276288 "{{STRIPE_SECRET_KEY}}" : config .get ("stripe" , {}).get ("secret_key" , "" ),
277289 "{{STRIPE_WEBHOOK_SECRET}}" : config .get ("stripe" , {}).get ("webhook_secret" , "" ),
278290 "{{STRIPE_PRO_PRICE_ID}}" : config .get ("stripe" , {}).get ("pro_price_id" , "" ),
279291 # Google OAuth
280292 "{{GOOGLE_CLIENT_ID}}" : config .get ("google_oauth" , {}).get ("client_id" , "" ),
281- "{{GOOGLE_CLIENT_SECRET}}" : config .get ("google_oauth" , {}).get ("client_secret" , "" ),
293+ "{{GOOGLE_CLIENT_SECRET}}" : config .get ("google_oauth" , {}).get (
294+ "client_secret" , ""
295+ ),
282296 # SendGrid
283297 "{{SENDGRID_API_KEY}}" : config .get ("sendgrid" , {}).get ("api_key" , "" ),
284298 # Sentry
285299 "{{SENTRY_DSN}}" : config .get ("sentry" , {}).get ("dsn" , "" ),
286300 # Backup
287301 "{{BACKUP_S3_BUCKET}}" : config .get ("backup" , {}).get ("s3_bucket" , "" ),
288- "{{BACKUP_RETENTION_DAYS}}" : config .get ("backup" , {}).get ("retention_days" , "30" ),
302+ "{{BACKUP_RETENTION_DAYS}}" : config .get ("backup" , {}).get (
303+ "retention_days" , "30"
304+ ),
289305 "{{BACKUP_PREFIX}}" : config .get ("backup" , {}).get ("prefix" , "backups/" ),
290306 }
291307
0 commit comments