warbler-cda / run_api.ps1
Bellok's picture
there-is-already-a-branch (#1)
a28932a verified
raw
history blame
1.75 kB
# Direct Python API Runner (Windows)
# Bypasses Docker networking issues
Write-Host "πŸš€ Starting Warbler CDA FractalStat API (Direct Python)" -ForegroundColor Green
Write-Host "======================================================" -ForegroundColor Green
Write-Host ""
# Check Python
try {
$pythonVersion = & python --version 2>&1
Write-Host "βœ… Python available: $pythonVersion" -ForegroundColor Green
} catch {
Write-Host "❌ Python not found. Install Python 3.11+" -ForegroundColor Red
exit 1
}
# Check if virtual environment is activated (optional)
if ($env:VIRTUAL_ENV) {
Write-Host "βœ… Virtual environment active: $($env:VIRTUAL_ENV)" -ForegroundColor Green
} else {
Write-Host "[Info] Consider activating virtual environment: .\venv\Scripts\Activate.ps1" -ForegroundColor Yellow
}
# Set environment variables
$env:FRACTALSTAT_TESTING = "true"
$env:PYTHONPATH = "$PWD"
Write-Host ""
Write-Host "πŸ“¦ Starting FastAPI server..." -ForegroundColor Cyan
Write-Host " Access at: http://localhost:8000" -ForegroundColor Yellow
Write-Host " Health check: http://localhost:8000/health" -ForegroundColor Yellow
Write-Host " API docs: http://localhost:8000/docs" -ForegroundColor Yellow
Write-Host ""
Write-Host "πŸ›‘ Press Ctrl+C to stop the server" -ForegroundColor Red
Write-Host ""
# Run the API service directly with detailed error capture
Write-Host "πŸ”§ Starting API service with debug output..." -ForegroundColor Cyan
Write-Host " This will show import progress and any startup issues" -ForegroundColor Gray
Write-Host ""
try {
python start_server.py 2>&1
} catch {
Write-Host "❌ Error running API service:" -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Red
}