From 36c046ad6a191d97c49924e6c390454691d8a3c5 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 10 Oct 2023 20:25:00 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BC=98=E5=8C=96Windows=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/main.py b/app/main.py index d362166f..0ede24a0 100644 --- a/app/main.py +++ b/app/main.py @@ -63,10 +63,16 @@ def start_frontend(): if not SystemUtils.is_frozen(): return nginx_path = settings.ROOT_PATH / 'nginx' - nginx = 'nginx.exe' if SystemUtils.is_windows() else 'nginx' - if Path(nginx_path).exists(): - import subprocess - subprocess.Popen(f"cd {nginx_path}; start {nginx}", + if not nginx_path.exists(): + return + import subprocess + if SystemUtils.is_windows(): + subprocess.Popen("start nginx.exe", + cwd=nginx_path, + shell=True) + else: + subprocess.Popen("nohup ./nginx &", + cwd=nginx_path, shell=True)