Importing app when using Alembic raises ImportError
I guess you are trying to run
python env.py
In this case, your app directory is not in PYTHONPATH
.
solution 1
Run the app from parent dir:
python alembic/env.py
solution 2
Set the PYTHONPATH
before running the app
PYTHONPATH=/path/to/parent/dir python env.py
edit
I read about alembic
. As @mrorno said, just set the PYTHONPATH
before running alembic:
PYTHONPATH=. alembic upgrade head