Reputation: 315
I'm trying to use MVC architecture pattern with flask application but I'm getting circular import error when using routing before initializing SQLAlchemy. I am not able to understand the flow of where should I initialize SQLAlchemy since it is required by both model and controller and if initialized in app file then I am getting different error. I'm terrible in explaining my problem but I'm sharing github link to go through whole source code for better understanding.
Please explain the problem with this architecture as to how I can improvise and make it more scabable. Source Code
Any help will be appreciated. Thanks
Upvotes: 0
Views: 469
Reputation: 15722
You have a .flaskenv
file that reads
FLASK_APP=app.py
FLASK_DEBUG=1
But the file that starts your application up (entrypoint) is called centuryApi.py
so change .flaskenv
to this
FLASK_APP=centuryApi.py
FLASK_DEBUG=1
Upvotes: 1