Spaces:
Sleeping
Sleeping
| """FastAPI application entry point.""" | |
| from __future__ import annotations | |
| import logging | |
| import uvicorn | |
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from config.settings import Settings | |
| from src.api.router import router | |
| logging.basicConfig(level=logging.INFO, format="%(asctime)s %(name)s %(levelname)s %(message)s") | |
| def create_app() -> FastAPI: | |
| app = FastAPI( | |
| title="CAD Review API", | |
| description="3D CAD assembly review with exterior/interior splitting and compliance checking", | |
| version="0.1.0", | |
| ) | |
| settings = Settings() | |
| allow_credentials = settings.allowed_origins != ["*"] | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=settings.allowed_origins, | |
| allow_credentials=allow_credentials, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| app.include_router(router) | |
| return app | |
| app = create_app() | |
| def run_server() -> None: | |
| uvicorn.run("src.api.main:app", host="0.0.0.0", port=8000, reload=True) | |