# GreaterWMS 后端启动脚本 # 此脚本会启动后端服务 Write-Host "=====================================" -ForegroundColor Cyan Write-Host " GreaterWMS 后端启动脚本" -ForegroundColor Cyan Write-Host "=====================================" -ForegroundColor Cyan Write-Host "" # 获取脚本所在目录 $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path Set-Location $ScriptDir # 检查Python是否安装 Write-Host "[1/2] 检查Python环境..." -ForegroundColor Yellow try { $pythonVersion = python --version Write-Host "✓ Python已安装: $pythonVersion" -ForegroundColor Green } catch { Write-Host "✗ 未找到Python,请先安装Python" -ForegroundColor Red pause exit 1 } # 启动后端服务 Write-Host "[2/2] 启动后端服务..." -ForegroundColor Yellow Write-Host "后端服务将运行在: http://0.0.0.0:8008" -ForegroundColor Cyan # 在新窗口中启动后端 $backendScript = @" cd '$ScriptDir' python manage.py makemigrations python manage.py migrate Write-Host '后端服务启动中...' -ForegroundColor Green daphne -b 0.0.0.0 -p 8008 greaterwms.asgi:application pause "@ Start-Process powershell -ArgumentList "-NoExit", "-Command", $backendScript Write-Host "" Write-Host "=====================================" -ForegroundColor Green Write-Host "✓ 后端服务启动完成!" -ForegroundColor Green Write-Host "=====================================" -ForegroundColor Green Write-Host "" Write-Host "后端服务: http://localhost:8008" -ForegroundColor Cyan Write-Host "" Write-Host "服务窗口已打开,请勿关闭。" -ForegroundColor Yellow Write-Host "按任意键退出此窗口(服务将继续运行)..." -ForegroundColor Gray pause