From a5c5da50c67e9ee14bd92f0740999eef081dc2e7 Mon Sep 17 00:00:00 2001 From: xiaoxia-dev Date: Sat, 27 Jun 2026 17:17:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20jwt=5Fservice.py=20?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=20settings=20=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=AF=BC=E8=87=B4=E7=99=BB=E5=BD=95=20401?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - packages.config.settings 模块不存在,改为 from app.config import settings - 此 bug 导致 JWT token 生成时 ModuleNotFoundError,被 except 捕获后返回通用 401 --- infra/docker/compose.yml | 42 ++++++++++++++--------------- packages/domain/auth/jwt_service.py | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) mode change 100755 => 100644 infra/docker/compose.yml diff --git a/infra/docker/compose.yml b/infra/docker/compose.yml old mode 100755 new mode 100644 index b26fec35b..cb09d1140 --- a/infra/docker/compose.yml +++ b/infra/docker/compose.yml @@ -72,14 +72,14 @@ services: # ========================================= # 资源限制建议(生产环境建议启用) # ========================================= - # deploy: - # resources: - # limits: - # cpus: '2.0' - # memory: 2G - # reservations: - # cpus: '0.5' - # memory: 512M + deploy: + resources: + limits: + cpus: '2.0' + memory: 2G + reservations: + cpus: '0.5' + memory: 512M # ========================================= # Worker 服务(Celery 任务队列) @@ -112,14 +112,14 @@ services: # 资源限制建议(生产环境建议启用) # ========================================= # 注意: Worker 需要处理视频,建议分配更多资源 - # deploy: - # resources: - # limits: - # cpus: '2.0' - # memory: 4G - # reservations: - # cpus: '0.5' - # memory: 1G + deploy: + resources: + limits: + cpus: '2.0' + memory: 4G + reservations: + cpus: '0.5' + memory: 1G # ========================================= # Web 服务(Nginx + 前端静态文件) @@ -159,11 +159,11 @@ services: # ========================================= # 资源限制建议 # ========================================= - # deploy: - # resources: - # limits: - # cpus: '0.5' - # memory: 256M + deploy: + resources: + limits: + cpus: '0.5' + memory: 512M # =========================================== # 共享卷配置 diff --git a/packages/domain/auth/jwt_service.py b/packages/domain/auth/jwt_service.py index 0e79cb08c..a1b996986 100644 --- a/packages/domain/auth/jwt_service.py +++ b/packages/domain/auth/jwt_service.py @@ -229,7 +229,7 @@ _jwt_service_instance = None def _get_jwt_service(): global _jwt_service_instance if _jwt_service_instance is None: - from packages.config.settings import settings + from app.config import settings kw = dict(secret_key=settings.JWT_SECRET_KEY) if hasattr(settings, "JWT_ALGORITHM"): kw["algorithm"] = settings.JWT_ALGORITHM