File size: 686 Bytes
2532605 46c1c8b 2532605 46c1c8b 2532605 46c1c8b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | """Startup script that loads .env and starts the FastAPI app."""
import os
import sys
from pathlib import Path
# Load .env file
env_file = Path(__file__).parent / ".env"
if env_file.exists():
print(f"Loading {env_file}")
from dotenv import load_dotenv
load_dotenv(env_file)
print(f" KRONECTOR_MODEL_RUN_ID = {os.getenv('KRONECTOR_MODEL_RUN_ID')}")
else:
print(f"Warning: {env_file} not found")
# Start uvicorn
if __name__ == "__main__":
import uvicorn
port = int(os.getenv("PORT", 8080))
print(f" Starting on http://127.0.0.1:{port}")
uvicorn.run(
"api.main:app",
host="127.0.0.1",
port=port,
reload=False,
)
|