Files
KCGL/inventory-backend/run.py

14 lines
525 B
Python
Raw Normal View History

2026-02-04 13:30:07 +08:00
# inventory-backend/run.py
2026-01-26 13:47:53 +08:00
from app import create_app
2026-02-04 13:30:07 +08:00
# 【关键】这一行必须在最外层,不能放在 if __name__ ... 里面!
# Gunicorn 会导入这个变量
2026-01-26 13:47:53 +08:00
app = create_app()
if __name__ == '__main__':
2026-02-04 13:30:07 +08:00
# 这里是开发调试用的,Docker/Gunicorn 不会执行这里
print("\n====== 当前所有注册路由 ======")
for rule in app.url_map.iter_rules():
print(f"{rule} -> {rule.endpoint}")
print("==============================\n")
2026-02-04 13:30:07 +08:00
app.run(host='0.0.0.0', port=8000, debug=True)