I\'m having a hard time to make my application run. Flask-SQLAlchemy extension creates an empty database whenever I try to separate module in packages. To better explain what I\
Your problem is this line:
db = SQLAlchemy(app)
it should be this:
db.init_app(app)
By running SQLAlchemy app again, you're reassigning db to the newly created db obj.
Please try NOT to move away from the application factory setup. It removes import time side effects and is a GOOD thing. In fact, you may want to import db inside your factory because importing a model that subclasses the Base (db.model in this case) has side effects of its own (tho less of an issue).
Initializing your app in a __init__.py
means that when you importing anything from your package for use, you're going to end up bootstrapping your app, even if you don't need it.