From 04c750f2dd5acf056467ad692b929a97aecc3c2f Mon Sep 17 00:00:00 2001 From: dekun Date: Sun, 4 Oct 2026 07:50:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20PM2=20=E4=B8=8B=20Flask=20?= =?UTF-8?q?debug=3DTrue=20=E7=83=AD=E9=87=8D=E8=BD=BD=E5=AF=BC=E8=87=B4=20?= =?UTF-8?q?Bad=20file=20descriptor=20=E5=B4=A9=E6=BA=83=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- app.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 8766628..a3caa39 100644 --- a/app.py +++ b/app.py @@ -765,4 +765,12 @@ def api_cond_orders_exit(hub_order_id: str): if __name__ == "__main__": - app.run(host=APP_HOST, port=APP_PORT, debug=True, threaded=True) + # PM2 下禁止 debug reloader,否则会 Bad file descriptor 崩循环 + _debug = (os.getenv("APP_DEBUG") or "").strip().lower() in ("1", "true", "yes", "on") + app.run( + host=APP_HOST, + port=APP_PORT, + debug=_debug, + use_reloader=False, + threaded=True, + )