Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from app.api import api_router | |
| from app.config import get_settings | |
| settings = get_settings() | |
| app = FastAPI( | |
| title=settings.app_name, | |
| version="1.0.0", | |
| description="LSTM-based stock prediction API for the QuantMind dashboard.", | |
| ) | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=settings.cors_origins, | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| def startup_event(): | |
| # Fail fast if critical config is missing | |
| settings.validate() | |
| print("[Startup] QuantMind backend initialized successfully") | |
| app.include_router(api_router) | |