- 新增 Pagination 通用组件:首页/上一页/页码/下一页/末页导航 - PickModal 和 SwapModal 集成分页功能,每页20项 - 搜索/筛选切换自动回到第1页 - 现代化CSS样式:hover浮起动效、主色高亮、移动端适配 - 新增 dashboard、admin 管理模板 - 菜系(cuisine)模型和迁移 - 构建脚本 build.py 支持 PyInstaller 打包 - 前端资源重新构建
21 lines
888 B
Python
21 lines
888 B
Python
import os
|
|
|
|
FILE = r"C:\Users\12914\Desktop\school-meal\run.py"
|
|
with open(FILE, "r", encoding="utf-8") as f:
|
|
content = f.read()
|
|
|
|
# The setup_environment function has: sys.path.insert(0, base)
|
|
# But base is the project root. The config module is in backend/.
|
|
# In dev mode, we need to also add backend/ to sys.path.
|
|
old = " sys.path.insert(0, base)\n os.environ.setdefault"
|
|
new = " sys.path.insert(0, base)\n # In dev mode, add backend/ to path so config and meals are importable\n backend_dir = os.path.join(base, 'backend')\n if os.path.isdir(backend_dir) and backend_dir not in sys.path:\n sys.path.insert(0, backend_dir)\n os.environ.setdefault"
|
|
|
|
if old in content:
|
|
content = content.replace(old, new, 1)
|
|
print("Fixed sys.path")
|
|
else:
|
|
print("Pattern not found")
|
|
|
|
with open(FILE, "w", encoding="utf-8") as f:
|
|
f.write(content)
|
|
print("Done") |