更新
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
@echo off
|
||||
setlocal EnableExtensions
|
||||
cd /d "%~dp0backend"
|
||||
|
||||
set "PLAYWRIGHT_BROWSERS_PATH=%LOCALAPPDATA%\ms-playwright"
|
||||
|
||||
echo [System] Checking port 8800...
|
||||
for /f "tokens=5" %%P in ('%SystemRoot%\System32\netstat.exe -aon ^| %SystemRoot%\System32\findstr.exe ":8800" ^| %SystemRoot%\System32\findstr.exe "LISTENING"') do (
|
||||
if not "%%P"=="0" (
|
||||
echo [System] Stopping process on port 8800, PID %%P
|
||||
%SystemRoot%\System32\taskkill.exe /F /PID %%P >nul 2>&1
|
||||
)
|
||||
)
|
||||
|
||||
REM Fallback if netstat loop failed
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
|
||||
"$p = Get-NetTCPConnection -LocalPort 8800 -State Listen -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess -Unique; foreach ($i in $p) { if ($i) { Write-Host ('[System] Stopping PID ' + $i); Stop-Process -Id $i -Force -ErrorAction SilentlyContinue } }" ^
|
||||
2>nul
|
||||
|
||||
%SystemRoot%\System32\PING.EXE -n 2 127.0.0.1 >nul
|
||||
|
||||
echo [System] Starting FastAPI backend...
|
||||
echo [System] URL: http://localhost:8800
|
||||
echo [System] Web UI: http://localhost:8800 - use start_web.bat for full UI
|
||||
echo [System] Playwright browsers: %PLAYWRIGHT_BROWSERS_PATH%
|
||||
echo [System] Login flow: wait for browser scan, auto-save cookie
|
||||
echo.
|
||||
|
||||
if not exist ".venv\Scripts\python.exe" (
|
||||
echo [Error] Python environment not found. Run install.bat first.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
".venv\Scripts\python.exe" -c "import uvicorn" >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo [Error] uvicorn module not found. Run install.bat first.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
call ".venv\Scripts\python.exe" -m uvicorn main:app --host 0.0.0.0 --port 8800
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
echo [Error] Backend failed to start.
|
||||
echo Review the error output above for the actual cause.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
Reference in New Issue
Block a user