I’ve been following several tutorials making use of SQLite databases and everything is working fine, except for the database that is never written to disk, as far as I can see.
For example, on step 6 of this tutorial from Digital Ocean How To Add Authentication to Your App with Flask-Login, I get the following error:
>>> from project import db, create_app, models
>>> db.create_all(app=create_app()) # pass the create_app result so Flask-SQLAlchemy gets the configuration.
TypeError: SQLAlchemy.create_all() got an unexpected keyword argument 'app'
I also tried:
>>> with app.app_context():
... db.create_all()
File "<stdin>", line 1, in <module>
NameError: name 'app' is not defined
I should get a db.sqlite
file in my project directory, but nothing is there.
How to solve this database creation issue?