增加查看Gunicorn的日志的按钮和功能

This commit is contained in:
2025-08-29 21:18:47 +08:00
parent 59b1f0e92a
commit 901b978cc8
10 changed files with 736 additions and 463 deletions

View File

@@ -134,38 +134,43 @@ class RemoteCommandTab(QWidget):
logger.error(f"Git安装失败: {message}")
def clone_git(self):
"""克隆Git仓库到远程服务器"""
if not self.check_ssh_connection():
return
git_url = self.git_url_input.text().strip()
project_path = self.project_path_input.text().strip()
if not git_url or not project_path:
QMessageBox.warning(self, "警告", "请填写Git仓库URL和项目路径")
if not git_url:
QMessageBox.warning(self, "警告", "请输入Git仓库地址")
return
# 从config.json获取django_path作为克隆目标路径
try:
config_path = os.path.join(os.path.dirname(__file__), 'config.json')
with open(config_path, 'r', encoding='utf-8') as f:
config = json.load(f)
if config and 'servers' in config and len(config['servers']) > 0:
server_config = config['servers'][0]
django_path = server_config.get('django_path', '')
if django_path:
project_path = django_path
logger.info(f"使用django_path作为克隆目标路径: {django_path}")
except Exception as e:
logger.error(f"获取django_path失败: {str(e)}")
# 获取当前服务器配置
config = None
if self.parent and hasattr(self.parent, 'server_connection_tab'):
config = self.parent.server_connection_tab.get_current_config()
self.output_text.append(f"正在克隆 {git_url}{project_path}...")
self.clone_btn.setEnabled(False)
if config:
# 使用remote_directory而不是django_path
target_path = config.get('remote_directory', '/home/user')
project_name = config.get('project_name', 'myproject')
else:
# 如果没有config使用默认值
target_path = '/home/user'
project_name = 'myproject'
self.git_clone_thread = GitCloneThread(self.parent.ssh_client, git_url, project_path)
self.git_clone_thread.result_ready.connect(self.on_git_clone_result)
self.git_clone_thread.start()
# 获取密码
password = self.get_password()
if password is None:
return
self.output_text.append(f"正在克隆Git仓库 {git_url}{target_path}...")
self.clone_git_btn.setEnabled(False)
self.progress_bar.setVisible(True)
self.progress_bar.setValue(0)
self.clone_thread = CloneGitThread(self.parent.ssh_client, git_url, target_path, project_name, password)
self.clone_thread.progress_updated.connect(self.update_progress)
self.clone_thread.result_ready.connect(self.on_clone_git_result)
self.clone_thread.start()
def on_git_clone_result(self, success, message):
self.clone_btn.setEnabled(True)