更新所有模块框架,建表已写好,学生查询模块已经写好,正在写新增模块。

This commit is contained in:
Orangeeee
2026-09-21 08:41:49 +08:00
parent 4627b4a57a
commit 1f4fa614e5
8 changed files with 276 additions and 2 deletions
+25
View File
@@ -0,0 +1,25 @@
# databases链接数据库
from sqlalchemy import *
from sqlalchemy.orm import sessionmaker,declarative_base
db_url = "mysql+pymysql://root:420821@localhost:3306/student_manage_system?charset=utf8mb4"
engine1 = create_engine(db_url)
Base = declarative_base()
Session = sessionmaker(bind=engine1
,autoflush=False
,autocommit=False)
def get_db():
db = Session()
try:
yield db
finally:
db.close()