flask报错 AttributeError: 'NoneType' object has no attribute 'metadata'
程序员文章站
2022-03-26 19:33:22
...
(venv) D:\000flask>flask db migrate
Traceback (most recent call last):
......
File "migrations\env.py", line 27, in <module>
target_metadata = current_app.extensions['migrate'].db.metadata
AttributeError: 'NoneType' object has no attribute 'metadata'
db = SQLAlchemy()
migrate = Migrate()
def create_app(object_name):
app = Flask(__name__)
db.init_app(app)
migrate.init_app(app)
return app
migrate
对象初始化时db
也应作为参数传入
migrate.init_app(app,db)
上一篇: threejs 根据svg创建
下一篇: Redis介绍及几种类型
推荐阅读
-
python编程排除163邮箱发送邮件报错(AttributeError: ‘tuple‘ object has no attribute ‘encode‘)
-
解决Keras报错AttributeError: 'NoneType' object has no attribute 'inbound_nodes'
-
AttributeError: ‘NoneType‘ object has no attribute ‘origin‘解决办法
-
Flask Web开发5.8:AttributeError: 'InstrumentedList' object has no attribute 'order
-
Flask Web开发5.8:AttributeError: 'InstrumentedList' object has no attribute 'order
-
使用torchsummary时报错AttributeError: ‘list‘ object has no attribute ‘size‘
-
Python 爬取网页信息 AttributeError :’NoneType’ object has no attribute ’attrs’
-
python报错:AttributeError: 'module' object has no attribute 'xfeatures2d'
-
wsgiref报错AttributeError: 'NoneType' object has no attribute 'split'
-
反向关联报错AttributeError: ‘ForeignKey‘ object has no attribute ‘rel‘从django源码找答案~