Skip to content

Commit

Permalink
fix(api): remove old code, register lifespan handler
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpomerenke committed Apr 10, 2024
1 parent b6af8d4 commit 9242947
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions backend-python/media_impact_monitor/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def app_lifespan(app: FastAPI):
yield


app = FastAPI(**metadata)
app = FastAPI(**metadata, lifespan=app_lifespan)

app.add_middleware(
CORSMiddleware,
Expand All @@ -63,15 +63,6 @@ async def app_lifespan(app: FastAPI):
)


@app.on_event("startup")
async def startup_event():
logger = logging.getLogger("uvicorn.access")
console_formatter = AccessFormatter(
"{asctime} {levelprefix} {message}", style="{", use_colors=True
)
logger.handlers[0].setFormatter(console_formatter)


@app.get("/", include_in_schema=False)
def read_root():
return RedirectResponse(url="/docs")
Expand Down

0 comments on commit 9242947

Please sign in to comment.