From f9cf408c82cd291ce1a2a90a8873d892da225f01 Mon Sep 17 00:00:00 2001 From: qing <1776177662@qq.com> Date: Wed, 29 Jul 2026 09:10:09 +0800 Subject: [PATCH] =?UTF-8?q?static:=20=E5=88=87=E6=8D=A2=20fsys.py=20?= =?UTF-8?q?=E5=88=B0=20Waitress=20WSGI=20=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - HTTP 场景使用 waitress.serve(threads=8) 替代 Flask 开发服务器 - SSL 场景回退 Flask 内置服务器(Waitress 不支持 TLS) - requirements.txt 新增 waitress 依赖 --- static/fsys.py | 5 ++++- static/requirements.txt | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/static/fsys.py b/static/fsys.py index bb8db56..4ced9a8 100644 --- a/static/fsys.py +++ b/static/fsys.py @@ -582,6 +582,9 @@ if __name__ == '__main__': print("\n") if SSL_ENABLED and os.path.exists(SSL_CERT_FILE) and os.path.exists(SSL_KEY_FILE): + # Waitress 不支持 TLS,SSL 场景回退到 Flask 内置服务器 + logger.warning("SSL enabled: falling back to Flask built-in server (Waitress has no TLS support)") app.run(host=host, port=port, ssl_context=(SSL_CERT_FILE, SSL_KEY_FILE), debug=False) else: - app.run(host=host, port=port, debug=False) + from waitress import serve + serve(app, host=host, port=port, threads=8) diff --git a/static/requirements.txt b/static/requirements.txt index 9535a30..f043a50 100644 --- a/static/requirements.txt +++ b/static/requirements.txt @@ -2,3 +2,4 @@ nuitka Flask>=2.3.0,<3.0.0 Flask-CORS>=4.0.0,<5.0.0 +waitress>=2.1.2,<4.0.0