'No application found. Either work inside a view function or push an application context.' [duplicate]
问题 This question already has answers here : creating a database outside the application context (3 answers) When scattering Flask Models, RuntimeError: 'application not registered on db' was raised (2 answers) Closed 2 years ago . I'm trying to separate my Flask-SQLAlchemy models into separate files. When I try to run db.create_all() I get No application found. Either work inside a view function or push an application context. shared/db.py : from flask_sqlalchemy import SQLAlchemy db =