2026-09-22 13:06:58 +08:00
|
|
|
from fastapi import FastAPI,APIRouter
|
|
|
|
|
from class_management.main import Classes_API
|
|
|
|
|
from scores.main import Scores_API
|
|
|
|
|
from stu_jiuye.main import Shtudent_Jiuye
|
|
|
|
|
from students.main import Students_API
|
|
|
|
|
from Teachers.main import Teachers_API
|
2026-09-22 21:05:09 +08:00
|
|
|
from StatCalc.main import StatCalc_API
|
2026-09-22 15:32:34 +08:00
|
|
|
from databases import *
|
2026-09-23 01:03:00 +08:00
|
|
|
from seed_data import seed_test_data
|
2026-09-22 13:06:58 +08:00
|
|
|
app = FastAPI(title="学生管理系统")
|
|
|
|
|
|
2026-09-23 03:53:57 +08:00
|
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
|
|
|
|
|
|
# 配置CORS - 接前端
|
|
|
|
|
app.add_middleware(
|
|
|
|
|
CORSMiddleware,
|
|
|
|
|
allow_origins=["*"], # 允许所有来源
|
|
|
|
|
allow_credentials=True,
|
|
|
|
|
allow_methods=["*"], # 允许所有方法
|
|
|
|
|
allow_headers=["*"], # 允许所有头部
|
|
|
|
|
)
|
2026-09-22 16:38:38 +08:00
|
|
|
|
2026-09-22 21:42:44 +08:00
|
|
|
app.include_router(Classes_API,tags=["班级管理模块"])
|
|
|
|
|
app.include_router(Scores_API,tags=["学生考核成绩管理模块"])
|
|
|
|
|
app.include_router(Shtudent_Jiuye,tags=["学生就业管理模块"])
|
|
|
|
|
app.include_router(Students_API,tags=["学生管理模块"])
|
|
|
|
|
app.include_router(Teachers_API,tags=["老师管理模块"])
|
|
|
|
|
app.include_router(StatCalc_API,tags=["统计分析模块"])
|
2026-09-19 18:16:15 +08:00
|
|
|
|
2026-09-22 18:23:13 +08:00
|
|
|
|
2026-09-19 18:16:15 +08:00
|
|
|
if __name__ == "__main__":
|
2026-09-22 19:47:02 +08:00
|
|
|
Base_all.metadata.create_all(bind=engine_all)
|
|
|
|
|
|
2026-09-22 16:38:38 +08:00
|
|
|
def main():
|
|
|
|
|
print("Hello from student-manage-system!")
|
|
|
|
|
|
2026-09-23 01:03:00 +08:00
|
|
|
seed_test_data()
|
|
|
|
|
|
2026-09-22 13:06:58 +08:00
|
|
|
import uvicorn
|
|
|
|
|
uvicorn.run("main:app", host="0.0.0.0", port=59000)
|
2026-09-22 15:14:32 +08:00
|
|
|
"""
|
|
|
|
|
IPv4 地址 . . . . . . . . . . . . : 192.168.6.40
|
|
|
|
|
子网掩码 . . . . . . . . . . . . : 255.255.255.0
|
|
|
|
|
默认网关. . . . . . . . . . . . . : 192.168.6.1
|
|
|
|
|
"""
|