feat: 改为安装包分发并使用动态端口
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
"""把后端冻成目录形式,供安装包直接启动,不在第一次打开时解压。"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DIST = ROOT / "build"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
DIST.mkdir(parents=True, exist_ok=True)
|
||||
subprocess.check_call(
|
||||
[
|
||||
sys.executable,
|
||||
"-m",
|
||||
"PyInstaller",
|
||||
"--noconfirm",
|
||||
"--clean",
|
||||
"--onedir",
|
||||
"--name",
|
||||
"nqi-backend",
|
||||
"--distpath",
|
||||
str(DIST),
|
||||
"--workpath",
|
||||
str(DIST / "pyinstaller"),
|
||||
"--specpath",
|
||||
str(DIST),
|
||||
"--collect-submodules",
|
||||
"app",
|
||||
"--collect-all",
|
||||
"uvicorn",
|
||||
"--collect-all",
|
||||
"openpyxl",
|
||||
"--collect-all",
|
||||
"cryptography",
|
||||
"--collect-all",
|
||||
"certifi",
|
||||
"--hidden-import",
|
||||
"multipart",
|
||||
str(ROOT / "nqi_backend.py"),
|
||||
],
|
||||
cwd=ROOT,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user