繁体   English   中英

烧瓶SQLAlchemy的。 AttributeError:模块“ <…> .db”没有属性“ Model”

[英]Flask-SQLAlchemy. AttributeError: module '<…>.db' has no attribute 'Model'

所以我有一个名为“ co”的模块

这是__init__.py

...
db = SQLAlchemy(app)
...

和models.py

...
from co import db
class BaseModel(db.Model):
    id = db.Column(db.Integer, primary_key=True)
...

运行flask db init给了我

AttributeError:模块“ co.db”没有属性“ Model”

我在这里做错了什么?

这意味着您具有以下文件夹结构

root
 - co
   - __init__.py
   - models.py
   - routes.py
 - myapp.py

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM