Answers for "pytest runtimeerror: no application found. either work inside a view function or push an application context"

0

pytest runtimeerror: no application found. either work inside a view function or push an application context

#Push an application context when running db.create_all()
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'My connection string'
db.init_app(app)

# Add the with statement below to encapsulate db.create_all()
with app.app_context():
    db.create_all()
Posted by: Guest on October-14-2021

Code answers related to "pytest runtimeerror: no application found. either work inside a view function or push an application context"

Python Answers by Framework

Browse Popular Code Answers by Language