<# Bootstrap script for DslrDirector on Windows. - Creates a local virtual environment (.venv) if missing - Activates the venv, upgrades pip, installs requirements.txt - Runs the Flask app (src/app.py) Usage: Open PowerShell in the project folder and run: .\bootstrap.ps1 Or explicitly allow script execution if needed: powershell -ExecutionPolicy Bypass -File .\bootstrap.ps1 Optional: pass a specific python executable: .\bootstrap.ps1 -PythonPath "C:\Path\To\python.exe" #> param( [string]$PythonPath = "python" ) $root = Split-Path -Parent $MyInvocation.MyCommand.Path Set-Location $root $venv = Join-Path $root '.venv' if (-not (Test-Path $venv)) { Write-Host "Creating virtual environment at $venv" & $PythonPath -m venv $venv } else { Write-Host "Virtual environment exists at $venv" } $activate = Join-Path $venv 'Scripts\Activate.ps1' if (-not (Test-Path $activate)) { Write-Error "Activation script not found: $activate" exit 1 } Write-Host "Activating venv..." # Dot-source the activation script to the current session . $activate Write-Host "Upgrading pip and installing requirements..." python -m pip install --upgrade pip if (Test-Path (Join-Path $root 'requirements.txt')) { python -m pip install -r (Join-Path $root 'requirements.txt') } Write-Host "Starting application... (press Ctrl-C to stop)" python .\src\app.py