1- Write-Host ' Creating python virtual environment "backend/backend_env"'
1+ Set-Location ../
2+
3+ # Function to get the venv python path based on OS and relative path
4+ function Get-VenvPythonPath {
5+ param ([string ]$relativePath )
6+ if ($IsLinux -or $IsMacOS ) {
7+ return " $relativePath /bin/python"
8+ } else {
9+ return " $relativePath /Scripts/python.exe"
10+ }
11+ }
12+
13+ Write-Host ' Creating python virtual environment ".venv"'
214$pythonCmd = Get-Command python - ErrorAction SilentlyContinue
315if (-not $pythonCmd ) {
416 # fallback to python3 if python not found
517 $pythonCmd = Get-Command python3 - ErrorAction SilentlyContinue
618}
7- Start-Process - FilePath ($pythonCmd ).Source - ArgumentList " -m venv ./backend/backend_env " - Wait - NoNewWindow
19+ Start-Process - FilePath ($pythonCmd ).Source - ArgumentList " -m venv .venv " - Wait - NoNewWindow
820
921Write-Host " "
1022Write-Host " Restoring backend python packages"
1123Write-Host " "
1224
13- $venvPythonPath = " ./venv/scripts/python.exe"
14- if (Test-Path - Path " /usr" ) {
15- # fallback to Linux venv path
16- $venvPythonPath = " ./venv/bin/python"
17- }
25+ $venvPythonPath = Get-VenvPythonPath " ./.venv"
1826
1927Start-Process - FilePath $venvPythonPath - ArgumentList " -m pip install -r app/backend/requirements.txt" - Wait - NoNewWindow
2028if ($LASTEXITCODE -ne 0 ) {
@@ -25,7 +33,7 @@ if ($LASTEXITCODE -ne 0) {
2533Write-Host " "
2634Write-Host " Restoring frontend npm packages"
2735Write-Host " "
28- Set-Location .. / frontend
36+ Set-Location app / frontend
2937npm install
3038if ($LASTEXITCODE -ne 0 ) {
3139 Write-Host " Failed to restore frontend npm packages"
@@ -46,6 +54,9 @@ Write-Host "Starting backend"
4654Write-Host " "
4755Set-Location ../ backend
4856
57+ # Update venv path for backend directory
58+ $venvPythonPath = Get-VenvPythonPath " ../../.venv"
59+
4960$port = 50505
5061$hostname = " localhost"
5162Start-Process - FilePath $venvPythonPath - ArgumentList " -m quart --app main:app run --port $port --host $hostname --reload" - Wait - NoNewWindow
0 commit comments