build: PyInstaller打包配置+启动器

This commit is contained in:
2026-05-08 16:15:45 +08:00
parent c7ba14a81a
commit a5f4275e19
4 changed files with 104 additions and 1 deletions
+22
View File
@@ -0,0 +1,22 @@
"""cDNA Analyzer 启动器 — 供 PyInstaller 打包"""
import os, sys, threading
# PyInstaller 打包后资源路径
if getattr(sys, 'frozen', False):
base = sys._MEIPASS
else:
base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# 设置模板和静态文件目录
os.environ['TEMPLATE_DIR'] = os.path.join(base, 'templates')
os.environ['STATIC_DIR'] = os.path.join(base, 'static')
# 导入 Flask app
from app import app
def open_browser():
os.startfile('http://localhost:5000')
if __name__ == '__main__':
threading.Timer(1.5, open_browser).start()
app.run(debug=False, port=5000)