No application found. Either work inside a view function or push an application context. 해결

2021. 5. 16. 11:54Study/Flask

https://flask-sqlalchemy.palletsprojects.com/en/2.x/contexts/

 

Introduction into Contexts — Flask-SQLAlchemy Documentation (2.x)

Introduction into Contexts If you are planning on using only one application you can largely skip this chapter. Just pass your application to the SQLAlchemy constructor and you’re usually set. However if you want to use more than one application or creat

flask-sqlalchemy.palletsprojects.com

 

>>> from yourapp import create_app
>>> app = create_app()
>>> app.app_context().push()
>>> from yourapp import db, create_app
>>> db.create_all(app=create_app())

순서대로 입력해준다음 sqlalchemy작업을 수행하면 성공적으로 실행되는 것을 볼수있다 ㅠㅠ