This commit is contained in:
jxxghp 2023-10-21 14:04:37 +08:00
parent d490fcf5af
commit a8b1fbbef0

View File

@ -62,17 +62,24 @@ def start_frontend():
""" """
if not SystemUtils.is_frozen(): if not SystemUtils.is_frozen():
return return
# 临时Nginx目录
nginx_path = settings.ROOT_PATH / 'nginx' nginx_path = settings.ROOT_PATH / 'nginx'
if not nginx_path.exists(): if not nginx_path.exists():
return return
# 配置目录下的Nginx目录
run_nginx_dir = settings.CONFIG_PATH.with_name('nginx')
if not run_nginx_dir.exists():
# 移动到配置目录
SystemUtils.move(nginx_path, run_nginx_dir)
# 启动Nginx
import subprocess import subprocess
if SystemUtils.is_windows(): if SystemUtils.is_windows():
subprocess.Popen("start nginx.exe", subprocess.Popen("start nginx.exe",
cwd=nginx_path, cwd=run_nginx_dir,
shell=True) shell=True)
else: else:
subprocess.Popen("nohup ./nginx &", subprocess.Popen("nohup ./nginx &",
cwd=nginx_path, cwd=run_nginx_dir,
shell=True) shell=True)