techwithtim / Flask-Web-App-Tutorial

Code for the note storing flask web app made during a YouTube video.
922 stars 1.02k forks source link

Update __init__.py #100

Closed xSparky911x closed 6 days ago

xSparky911x commented 1 year ago

Flask-SQLAlchemy 3 no longer accepts an app argument to methods like create_all. Instead, it always requires an active Flask application context. There is no need for that create_database function. SQLAlchemy will already not overwrite an existing file, and the only time the database wouldn't be created is if it raised an error.