'No application found. Either work inside a view function or push an application context.' [duplicate] 'No application found. Either work inside a view function or push an application context.' [duplicate] flask flask

'No application found. Either work inside a view function or push an application context.' [duplicate]


Use with app.app_context() to push an application context when creating the tables.

app = Flask(__name__)app.config['SQLALCHEMY_DATABASE_URI'] = 'My connection string'db.init_app(app)with app.app_context():    db.create_all()