Fix alembic migration Python path issue in env.py
- Added sys.path modification to ensure app module can be found - Fixed imports to follow proper order - Removed unused os import
This commit is contained in:
parent
77865dae90
commit
6330360ba1
@ -1,9 +1,16 @@
|
|||||||
from logging.config import fileConfig
|
from logging.config import fileConfig
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from sqlalchemy import engine_from_config
|
from sqlalchemy import engine_from_config
|
||||||
from sqlalchemy import pool
|
from sqlalchemy import pool
|
||||||
|
|
||||||
from alembic import context
|
from alembic import context
|
||||||
|
|
||||||
|
# This line adds the project root to the Python path
|
||||||
|
sys.path.insert(0, str(Path(__file__).parent.parent.absolute()))
|
||||||
|
|
||||||
|
# Import after setting up the path
|
||||||
from app.db.session import Base
|
from app.db.session import Base
|
||||||
|
|
||||||
# this is the Alembic Config object, which provides
|
# this is the Alembic Config object, which provides
|
||||||
|
Loading…
x
Reference in New Issue
Block a user