alembic/env.py target_metadata = metadata "No module name al_test.models" -
when use alembic control version of project's database,part of codes in env.py like:
# add model's metadata object here # 'autogenerate' support # myapp import mymodel # target_metadata = mymodel.base.metadata al_test.models import metadata target_metadata = metadata
when run 'alembic revision --autogenerate -m "added user table"', error : file "alembic/env.py", line 18, in al_test.models import metadata importerror: no module named al_test.models
so how solve question? thanks!
this might bit late, , may have figured out issue, guess problem alembic/ directory not part of system path. i.e. need like:
import sys sys.path.append(path/to/al_test) al_test.models import metadata
Comments
Post a Comment