班级模块

This commit is contained in:
2026-09-22 16:35:15 +08:00
parent a45d4046be
commit 3f3016d9ec
11 changed files with 417 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
from fastapi import FastAPI
from database import engine, Base
Base.metadata.create_all(engine)
from api.calss import class_api
from starlette.middleware.cors import CORSMiddleware
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # 允许所有源(生产环境建议指定具体域名)
allow_credentials=True, # 允许携带 Cookie 等凭证
allow_methods=["*"], # 允许所有 HTTP 方法(GET/POST/PUT/DELETE 等)
allow_headers=["*"], # 允许所有请求头
)
app.include_router(class_api,tags=['班级接口'],prefix='/stutent')
if __name__ == '__main__':
import uvicorn
uvicorn.run("main:app", host='127.0.0.1', port=12345)