18 lines
708 B
PowerShell
18 lines
708 B
PowerShell
param([int]$Port = 18901)
|
|
$ErrorActionPreference = 'Stop'
|
|
$taskRoot = Split-Path $PSScriptRoot -Parent
|
|
Set-Location -LiteralPath $taskRoot
|
|
$taskPython = Join-Path $PSScriptRoot '.venv\Scripts\python.exe'
|
|
if (-not (Test-Path -LiteralPath $taskPython)) {
|
|
$taskPython = Join-Path $taskRoot '.venv\Scripts\python.exe'
|
|
}
|
|
if (-not (Test-Path -LiteralPath $taskPython)) {
|
|
throw 'Run mt5_app/setup.ps1 first. See mt5_app/README.md.'
|
|
}
|
|
$env:PYTHONIOENCODING = 'utf-8'
|
|
$env:MT5_PORT = "$Port"
|
|
if (-not (Test-Path -LiteralPath (Join-Path $PSScriptRoot '.env'))) {
|
|
Copy-Item -LiteralPath (Join-Path $PSScriptRoot '.env.example') -Destination (Join-Path $PSScriptRoot '.env')
|
|
}
|
|
& $taskPython -m mt5_app serve
|