|
@@ -1,21 +1,23 @@
|
|
|
|
|
+from contextlib import asynccontextmanager
|
|
|
|
|
+
|
|
|
from fastapi import FastAPI
|
|
from fastapi import FastAPI
|
|
|
from fastapi.staticfiles import StaticFiles
|
|
from fastapi.staticfiles import StaticFiles
|
|
|
|
|
|
|
|
# from .db import Base, engine
|
|
# from .db import Base, engine
|
|
|
from .routes import router
|
|
from .routes import router
|
|
|
|
|
|
|
|
-app = FastAPI(title="GCOutline")
|
|
|
|
|
-
|
|
|
|
|
-app.include_router(router)
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
-@app.on_event("startup")
|
|
|
|
|
-def on_startup():
|
|
|
|
|
|
|
+@asynccontextmanager
|
|
|
|
|
+async def lifespan(_: FastAPI):
|
|
|
# Create tables for demo if they do not exist
|
|
# Create tables for demo if they do not exist
|
|
|
# Base.metadata.create_all(bind=engine)
|
|
# Base.metadata.create_all(bind=engine)
|
|
|
- pass
|
|
|
|
|
|
|
+ yield
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+app = FastAPI(title="GCOutline", lifespan=lifespan)
|
|
|
|
|
+
|
|
|
|
|
+app.include_router(router)
|
|
|
|
|
+
|
|
|
app.mount("/static", StaticFiles(directory="static"), name="static")
|
|
app.mount("/static", StaticFiles(directory="static"), name="static")
|
|
|
|
|
|
|
|
|
|
|