RuntimeError: No application found. Either work inside a view function or push an application context

Solution
from myapp import create_app, db
app = create_app()
with app.app_context():
    db.create_all()