签入版本

This commit is contained in:
2026-09-16 13:30:36 +08:00
parent 09f2c077d5
commit ba008258cd
6 changed files with 40 additions and 13 deletions
+1 -1
View File
@@ -234,7 +234,7 @@ def main():
print("\n操作完成!")
except Exception as e: # noqa: BLE001 - CLI 顶层兜底,输出可读错误
except Exception as e:
print(f"\n操作失败: {str(e)}")
import traceback
traceback.print_exc()
+12 -5
View File
@@ -8,13 +8,20 @@ from alembic import context
from sqlalchemy import create_mock_engine, engine_from_config, pool
# 将 src 加入 sys.path(与 scripts/init_db.py 一致),使 core / modules 可导入
SRC_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "src")
sys.path.insert(0, SRC_DIR)
_SRC_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "src")
from core.config import SQLALCHEMY_DATABASE_URL # noqa: E402
from core.database import Base # noqa: E402
def _setup_src_path():
if _SRC_DIR not in sys.path:
sys.path.insert(0, _SRC_DIR)
_setup_src_path()
from core.config import SQLALCHEMY_DATABASE_URL
from core.database import Base
# 加载全部模型以填充 metadata(create_app 会连带导入所有业务模块)
from core.app import create_app # noqa: E402
from core.app import create_app
create_app()
+15 -1
View File
@@ -46,7 +46,7 @@
"""常量与枚举统一入口(原 shared/__init__.py 迁移)。"""
from constants.constants import ( # noqa: F401
from constants.constants import (
PAGE_SIZE, # 默认每页显示记录数
DEFAULT_PASSWORD, # 默认密码
MESSAGE_OK, # 操作成功提示
@@ -59,3 +59,17 @@ from constants.constants import ( # noqa: F401
BANNED_UPLOAD_EXTS_MSG, # 禁止上传扩展名提示信息
JWT_SALT_MIN_LENGTH, # JWT 密钥最短长度
)
__all__ = [
"PAGE_SIZE",
"DEFAULT_PASSWORD",
"MESSAGE_OK",
"MESSAGE_FAIL",
"SERIALIZE_EXCLUDE_FIELDS",
"SUPERADMIN_ID",
"BUILTIN_ROLE_IDS",
"BUILTIN_UPLOAD_EXTS",
"BANNED_UPLOAD_EXTS",
"BANNED_UPLOAD_EXTS_MSG",
"JWT_SALT_MIN_LENGTH",
]
+1 -1
View File
@@ -134,7 +134,7 @@ def build_engine(driver: str | None = None, database_url: str | None = None):
if drv == 'oracle':
# 懒加载:仅 oracle 分支需要 oracledb(thin 模式,无需 Oracle Instant Client)
import oracledb # noqa: F401
import oracledb # 副作用:注册 SQLAlchemy Oracle 方言
return create_engine(
url,
pool_size=DB_POOL_SIZE,
+7 -1
View File
@@ -9,10 +9,16 @@ from pathlib import Path
# scripts/ 下无 __init__.py,把 scripts 目录加进 sys.path 以便直接 import
_SCRIPTS_DIR = Path(__file__).resolve().parents[3] / "scripts"
def _setup_scripts_path():
if str(_SCRIPTS_DIR) not in sys.path:
sys.path.insert(0, str(_SCRIPTS_DIR))
import init_db # noqa: E402
_setup_scripts_path()
import init_db
def test_oracle_sequence_sql():
+1 -1
View File
@@ -14,7 +14,7 @@
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?3025f35e9071c58643123b5f795c1e5e";
hm.src = "https://hm.baidu.com/hm.js?8d53050ad5cec3e955fce673f53d1032";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();