这是一个创建于 4671 天前的主题,其中的信息可能已经有所发展或是发生改变。
from flaskext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///models.db'
db = SQLAlchemy() #把这两行换成 db = SQLAlchemy(app)就正确了
db.init_app(app)
class Role(db.Model):
...
有这样的错误。。 为什么呢
raise RuntimeError('application not registered on db '
RuntimeError: application not registered on db instance and no application bound to current context
1 条回复 • 2017-05-28 13:59:48 +08:00
|
|
1
swcsend 2017-05-28 13:59:48 +08:00
|