|
@@ -1,12 +1,11 @@
|
|
# -*- coding: utf-8 -*-
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
import logging
|
|
import logging
|
|
-from pathlib import Path
|
|
|
|
|
|
|
|
import uvicorn
|
|
import uvicorn
|
|
from fastapi import FastAPI
|
|
from fastapi import FastAPI
|
|
-from loguru import logger
|
|
|
|
|
|
|
|
|
|
+from app.api.errors.iot import MissingIOTDataError, missing_data_exception_handler
|
|
from app.api.routers import (
|
|
from app.api.routers import (
|
|
algorithms,
|
|
algorithms,
|
|
targets,
|
|
targets,
|
|
@@ -25,12 +24,6 @@ from app.db.session import Base, engine
|
|
Base.metadata.create_all(bind=engine)
|
|
Base.metadata.create_all(bind=engine)
|
|
|
|
|
|
logging.getLogger().handlers = [InterceptHandler()]
|
|
logging.getLogger().handlers = [InterceptHandler()]
|
|
-# logger.add(
|
|
|
|
-# Path(settings.LOGS_DIR, "env_fastapi.log"),
|
|
|
|
-# level="INFO",
|
|
|
|
-# rotation="00:00",
|
|
|
|
-# encoding="utf-8",
|
|
|
|
-# )
|
|
|
|
|
|
|
|
|
|
|
|
def get_application() -> FastAPI:
|
|
def get_application() -> FastAPI:
|
|
@@ -51,6 +44,8 @@ def get_application() -> FastAPI:
|
|
application.include_router(space.router, prefix="/room", tags=["Spaces"])
|
|
application.include_router(space.router, prefix="/room", tags=["Spaces"])
|
|
application.include_router(targets.router, prefix="/target", tags=["Targets"])
|
|
application.include_router(targets.router, prefix="/target", tags=["Targets"])
|
|
|
|
|
|
|
|
+ application.add_exception_handler(MissingIOTDataError, missing_data_exception_handler)
|
|
|
|
+
|
|
return application
|
|
return application
|
|
|
|
|
|
|
|
|