From 4f574189c71b56d7748c44a418a61f9220e69d1c Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Tue, 29 Jul 2025 22:52:34 +0800 Subject: [PATCH] Fix the error trigger when model auto import (#743) --- backend/app/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/app/__init__.py b/backend/app/__init__.py index cb5efab6..097c2e18 100644 --- a/backend/app/__init__.py +++ b/backend/app/__init__.py @@ -25,9 +25,11 @@ def get_app_models(): try: module_path = f'backend.app.{app}.model' module = import_module_cached(module_path) - except Exception as e: + except ModuleNotFoundError as e: log.warning(f'应用 {app} 中不包含 model 相关配置: {e}') continue + except Exception as e: + raise e for name, obj in inspect.getmembers(module): if inspect.isclass(obj):