feat: 新增代码
This commit is contained in:
20
video_worker/scripts/run_server.ps1
Normal file
20
video_worker/scripts/run_server.ps1
Normal file
@@ -0,0 +1,20 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
Set-Location $Root
|
||||
|
||||
if (!(Test-Path .venv)) { throw ".venv not found, run scripts/install_windows_env.ps1 first" }
|
||||
if (!(Test-Path .env)) { throw ".env not found, copy from .env.example" }
|
||||
|
||||
.\.venv\Scripts\Activate.ps1
|
||||
Get-Content .env | ForEach-Object {
|
||||
if ($_ -match "^\s*#") { return }
|
||||
if ($_ -match "^\s*$") { return }
|
||||
$parts = $_ -split "=", 2
|
||||
if ($parts.Length -eq 2) {
|
||||
[System.Environment]::SetEnvironmentVariable($parts[0], $parts[1], "Process")
|
||||
}
|
||||
}
|
||||
|
||||
$hostValue = if ($env:APP_HOST) { $env:APP_HOST } else { "0.0.0.0" }
|
||||
$portValue = if ($env:APP_PORT) { $env:APP_PORT } else { "8000" }
|
||||
python -m uvicorn app.main:app --host $hostValue --port $portValue
|
||||
Reference in New Issue
Block a user