"""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)