From 343fc2060fbc1116f296330244f306cd76d03115 Mon Sep 17 00:00:00 2001 From: liuwei Date: Thu, 3 Apr 2025 12:08:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=90=8E=E5=8F=B0=20server?= =?UTF-8?q?=20=E4=BD=BF=E7=94=A8=E8=93=9D=E5=9B=BE=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E9=99=8D=E4=BD=8E=E7=BB=B4=E6=8A=A4=E6=88=90=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E9=99=8D=E4=BD=8E=E4=BF=AE=E6=94=B9=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=97=B6=E5=AF=B9=E5=85=B6=E4=BB=96=E6=A8=A1=E5=9D=97=E7=9A=84?= =?UTF-8?q?=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/dashboard/blueprints/contacts.py | 2 +- admin/dashboard/blueprints/system.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/admin/dashboard/blueprints/contacts.py b/admin/dashboard/blueprints/contacts.py index 42dbddc..18c280b 100644 --- a/admin/dashboard/blueprints/contacts.py +++ b/admin/dashboard/blueprints/contacts.py @@ -3,7 +3,7 @@ from .auth import login_required import logging # 创建联系人管理蓝图 -contacts_bp = Blueprint('contacts', __name__, url_prefix='/contacts') +contacts_bp = Blueprint('contacts', __name__) logger = logging.getLogger("ContactsBlueprint") # 联系人管理页面 diff --git a/admin/dashboard/blueprints/system.py b/admin/dashboard/blueprints/system.py index d0700c4..43fa758 100644 --- a/admin/dashboard/blueprints/system.py +++ b/admin/dashboard/blueprints/system.py @@ -48,9 +48,9 @@ def api_wx_logs(): lines = request.args.get('lines', 100, type=int) # 默认显示最后100行 # 修正日志文件路径计算,获取项目根目录 - # 从当前文件位置向上导航4层到项目根目录 + # 从当前文件位置向上导航3层到项目根目录 # blueprints -> dashboard -> admin -> WeChatRobot - project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..')) + project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')) if log_type == 'error': log_file = os.path.join(project_root, 'wx_error.log') @@ -67,6 +67,13 @@ def api_wx_logs(): log_content = list(deque(f, lines)) else: logger.warning(f"日志文件不存在: {log_file}") + + # 尝试列出项目根目录下的所有日志文件,帮助调试 + try: + all_files = [f for f in os.listdir(project_root) if f.endswith('.log')] + logger.info(f"项目根目录下的日志文件: {all_files}") + except Exception as e: + logger.error(f"列出目录文件失败: {e}") return jsonify({ "success": True,