签入版本
This commit is contained in:
+12
-5
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user