修改登录退出逻辑

This commit is contained in:
dxc
2026-02-04 14:29:59 +08:00
parent 13590b1fac
commit fd5600b65b
12 changed files with 411 additions and 235 deletions

View File

@ -1,14 +1,27 @@
# inventory-backend/run.py
from app import create_app
# 【关键】这一行必须在最外层,不能放在 if __name__ ... 里面!
# Gunicorn 会导入这个变量
# Gunicorn 或 uWSGI 会寻找名为 'app' 的实例
app = create_app()
if __name__ == '__main__':
# 这里是开发调试用的Docker/Gunicorn 不会执行这里
print("\n====== 当前所有注册路由 ======")
for rule in app.url_map.iter_rules():
print(f"{rule} -> {rule.endpoint}")
# =================================================
# 路由打印调试 (启动时会在控制台列出所有 URL)
# 这一步能帮你确认 /api/inbound/base/list 是否存在
# =================================================
print("\n====== 当前生效的路由映射 ======")
try:
# 按 URL 排序打印,方便查找
sorted_rules = sorted(app.url_map.iter_rules(), key=lambda x: str(x))
for rule in sorted_rules:
# 过滤掉一些系统自带的 static 路由,只显示 API
if 'api' in str(rule):
methods = ','.join(rule.methods - {'OPTIONS', 'HEAD'})
print(f"{str(rule):<50} | {methods:<10} | {rule.endpoint}")
except Exception:
pass
print("==============================\n")
# 启动开发服务器
# 端口设置为 5000 (Flask 默认) 或 8000请确保与前端 Vite 代理一致
app.run(host='0.0.0.0', port=8000, debug=True)