To solve this, set up an application context with app.app_context(). See the documentation for more information.
This typically means that you attempted to use functionality that needed the current application. To solve this, set up an application context with app.app_context(). See the documentation for more information. 这个是flask经典问题,属于上下文问题,添加这个下面这个即可。 app.app_context().push() 示例:
app = Flask(__name__) app.config.from_object(settings.Configs) # 加载flask项目配置 app.app_context().push() db=SQLAlchemy(app) # 创建映射对象,并绑定在app中
版权声明:本文内容由互联网用户撰写,该文观点仅代表作者本人。本站爱分享仅提供分享服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,请立马联系本站,本站将立刻删除。
THE END
二维码
文章目录
关闭
共有 0 条评论