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