Reputation: 1943
I have installed flask and flask-sqlalchemy in my base environment of the conda. I defined the models in separate file (model.py), when I am trying to import it in my app.py file it's throwing the following error
Upvotes: 0
Views: 96
Reputation: 978
When you write from model import User
, you cause python to import from app import db
, i.e. import app
into app
, which is not allowed in python
Please, take a look at this answer, I wrote it pretty straightforward how to solve this problem with flask-sqlalchemy
:
https://stackoverflow.com/a/62991785/10468419
Upvotes: 1