CostEvalPlatform/main.py
2024-11-20 16:25:36 +08:00

27 lines
637 B
Python

from contextlib import asynccontextmanager
from fastapi import FastAPI
from api import login_reg, manage_project, manage_tanant, manage_user
from database import create_db_and_tables
# 用于生成和验证JWT的密钥
SECRET_KEY = "your_secret_key"
ALGORITHM = "HS256"
# @app.on_event("startup")
# def on_startup():
# create_db_and_tables()
@asynccontextmanager
async def lifespan(app: FastAPI):
create_db_and_tables()
yield
app = FastAPI(lifespan=lifespan)
app.include_router(login_reg.router)
app.include_router(manage_tanant.router)
app.include_router(manage_user.router)
app.include_router(manage_project.router)