班级模块
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user