尝试合并,所有代码需要调整from后文件路径。

This commit is contained in:
Orangeeee
2026-09-22 12:23:18 +08:00
parent 73da38f445
commit cae04fd04a
16 changed files with 116 additions and 43 deletions
+8 -7
View File
@@ -1,9 +1,11 @@
from fastapi import FastAPI
from students.api.students_api import students_api
from fastapi import FastAPI,APIRouter
from students.api.students_api import s_api
from students.databases import *
from students.model import students_model
from contextlib import asynccontextmanager
Students_API = APIRouter()
@asynccontextmanager
async def lifespan(app: FastAPI):
Base.metadata.create_all(engine1)
@@ -12,14 +14,13 @@ async def lifespan(app: FastAPI):
app = FastAPI(title="学生管理系统",lifespan=lifespan) # 这里必须把上面写的加上
app.include_router(students_api,tags=["students"])
def main():
print("Hello from student-manage-system!")
app.include_router(s_api,tags=["students"])
if __name__ == "__main__":
def main():
print("Hello from student-manage-system!")
import uvicorn
uvicorn.run("main:app", host="0.0.0.0", port=51000)