Files
1/main.py
T
2026-09-13 22:46:47 +08:00

28 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#项目初始化入口
from fastapi import FastAPI
# 周学灵、熊浩钦、圣国伟、刘盼、彭少、赵康宁的路由
from api import wl_student_api,wl_class_api,wl_score_api,wl_teacher_api,statistics,wl_emp_api
from database import Base, engine
# wl_emp_model 必须显式导入:否则 wl_emp 表只能靠 statistics 的传递导入进 metadata,
# 一旦统计路由被拿掉,create_all 会漏建 wl_emp,Student.emp 关系随即报错
from model import wl_student_model,wl_class_model,wl_advisor_model,wl_score_model,wl_teacher_model,wl_emp_model
Base.metadata.drop_all(engine)
Base.metadata.create_all(bind=engine)
app = FastAPI(title="沃林学生管理系统")
app.include_router(wl_student_api.router)
app.include_router(wl_class_api.router)
app.include_router(wl_score_api.router)
app.include_router(wl_teacher_api.router)
app.include_router(statistics.router)
app.include_router(wl_emp_api.router)
if __name__ == "__main__":
import uvicorn
uvicorn.run("main:app", host="0.0.0.0", port=8001,reload=True)