diff --git a/app/__init__.py b/app/__init__.py index ffeea74..1f27be3 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -39,11 +39,18 @@ def create_app(): app.register_blueprint(main_bp) app.register_blueprint(templates_bp) app.register_blueprint(goals_bp) + from app.routes import student_goals + app.register_blueprint(student_goals.student_goals_bp) # 创建数据库和目录 with app.app_context(): os.makedirs(os.path.join(BASE_DIR, "data"), exist_ok=True) os.makedirs(app.config["PDF_OUTPUT_DIR"], exist_ok=True) + + # 确保所有模型都被导入 + from app.models import Student, Problem, StudentProblem, Template, PracticePlan + from app.models import Goal, GoalRelation, StudentGoal # 新增目标相关模型 + db.create_all() # 简单迁移:为已存在的数据库添加新字段(必须在init_default_templates之前) diff --git a/app/templates/student.html b/app/templates/student.html index bcd8c6c..bb1cf5a 100644 --- a/app/templates/student.html +++ b/app/templates/student.html @@ -56,6 +56,19 @@ + +