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,