测试Gunicorn通过,网页可以打开

This commit is contained in:
2025-08-30 21:05:56 +08:00
parent 0a673cf2bb
commit 99b2ff7535
6 changed files with 777 additions and 528 deletions

View File

@@ -370,10 +370,18 @@ WantedBy=multi-user.target"""
# 获取端口配置
port = self.port_input.text().strip() or "8000"
# 记录测试参数
logger.info(f"开始测试GunicornDjango路径: {django_path}, 端口: {port}")
# 获取主机地址配置
host = "127.0.0.1" # 默认值
if self.parent and hasattr(self.parent, 'get_current_config'):
config = self.parent.get_current_config()
if config and 'host' in config:
host = config['host']
logger.info(f"从配置获取主机地址: {host}")
self.output_text.append(f"正在测试Gunicorn {django_path} (端口: {port})...")
# 记录测试参数
logger.info(f"开始测试GunicornDjango路径: {django_path}, 端口: {port}, 主机: {host}")
self.output_text.append(f"正在测试Gunicorn {django_path} (端口: {port}, 主机: {host})...")
self.test_gunicorn_btn.setEnabled(False)
self.progress_bar.setVisible(True)
self.progress_bar.setValue(0)
@@ -381,7 +389,7 @@ WantedBy=multi-user.target"""
logger.info("创建Gunicorn测试线程")
# 注意GunicornTestThread构造函数可能需要更新以接受端口参数
# 确保测试时使用的端口与实际服务启动时一致
self.gunicorn_test_thread = GunicornTestThread(self.parent.ssh_client, django_path, port)
self.gunicorn_test_thread = GunicornTestThread(self.parent.ssh_client, django_path, port, host)
self.gunicorn_test_thread.progress_updated.connect(self.update_progress)
self.gunicorn_test_thread.result_ready.connect(self.on_test_gunicorn_result)
self.gunicorn_test_thread.start()