调整证书路径
This commit is contained in:
@@ -43,11 +43,17 @@ def _run_flask_role():
|
||||
# 把 WSGI Flask app 包成 ASGI app
|
||||
asgi_app = WsgiToAsgi(app)
|
||||
|
||||
# Hypercorn 配置
|
||||
# 自动定位 resources 目录
|
||||
base_dir = os.path.dirname(os.path.abspath(__file__)) # 当前 py 的目录(Module/)
|
||||
project_root = os.path.dirname(base_dir) # 回到项目根目录(iOSAi/)
|
||||
resource_dir = os.path.join(project_root, "resources") # 拼到 resources
|
||||
# ==== 关键:统一获取 resources 目录 ====
|
||||
if "__compiled__" in globals():
|
||||
# 被 Nuitka 编译后的 exe 运行时
|
||||
base_dir = os.path.dirname(sys.executable) # exe 所在目录
|
||||
else:
|
||||
# 开发环境,直接跑 .py
|
||||
cur_file = os.path.abspath(__file__) # Module/Main.py 所在目录
|
||||
base_dir = os.path.dirname(os.path.dirname(cur_file)) # 回到项目根 iOSAi
|
||||
|
||||
resource_dir = os.path.join(base_dir, "resources")
|
||||
|
||||
|
||||
config = Config()
|
||||
config.bind = [f"0.0.0.0:{flaskPort}"]
|
||||
|
||||
Reference in New Issue
Block a user