Issue
I am reading (and watching) about Flask-Migrate here: https://realpython.com/blog/python/flask-by-example-part-2-postgres-sqlalchemy-and-alembic/ and here https://www.youtube.com/watch?v=YJibNSI-iaE#t=21
and doing everything from this tutorial:
- I started a local postgres server (using Postgres.App, which started the server at postgresql://localhost:5432)
- updated configs as per said tutorial
- updated app.py, created a models.py etc.
After you install Flask-Migrate and run
python manage.py db init
python manage.py db migrate
it should detect all tables declared in models.py.
In my case, it detects nothing. And, based on the comments to the tutorial, it's not just my case. So, how do I make this work?
Solution
Make sure your model is imported by your app. In most cases your views.py
should do that. But you can also import it directly from your app.py
.
Answered By - Klaus D.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.