Question

I have a flask application spread across modules with blueprints. Each module/blueprint has its own models.py file where models are defined.

When the application runs, I would like SQLAlchemy to create the SQLite file at the location set with SQLALCHEMY_DATABASE_URI configuration.

With a regular Python application without any extraction layers above SA using base.metadata.create_all(..)

How can I do this with Flask and SQLAlchemy extension?

Was it helpful?

Solution

I suspect you have somewhere :

db = SQLAlchemy(app)

so all you have to do is

db.create_all()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top