techwithtim / Flask-Web-App-Tutorial

Code for the note storing flask web app made during a YouTube video.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: create_all() got an unexpected keyword argument 'app'

nicknameyu opened this issue · comments

just cloned the repo and run in debug mode and hit below error

Flask-Web-App-Tutorial % /usr/bin/python3 /projects/Flask-Web-App-Tutorial/main.py
Traceback (most recent call last):
  File "/projects/Flask-Web-App-Tutorial/main.py", line 3, in <module>
    app = create_app()
  File "/projects/Flask-Web-App-Tutorial/website/__init__.py", line 24, in create_app
    create_database(app)
  File "/projects/Flask-Web-App-Tutorial/website/__init__.py", line 39, in create_database
    db.create_all(app=app)
TypeError: create_all() got an unexpected keyword argument 'app'

Flask-Web-App-Tutorial % python3 --version
Python 3.9.6
What am I missing?

See my pull request: 80de2df

You need to wrap it in an app context for new versions of Flask SQLAlchemy.

@tkburis , thanks, it works