我正在尝试使用Flask、Flask login和Flask MongoKit组装一个基本的登录系统。你知道吗
这是我的User
课程:
class User(Document):
__collection__ = 'users'
structure = {
'username': basestring,
'password': basestring,
'date_created': datetime
}
required_fields = ['username', 'password']
default_values = {
'date_created': datetime.utcnow
}
当我将文档模型连接到数据库(db.register([User])
)时,对文档(db.User.one({'username': form.username})
)进行查询会产生以下可爱的错误:
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
我完全不明白这个错误,我也不知道该怎么纠正它。怎么了?你知道吗
注意:我理解什么是元类冲突。我不知道我是怎么造成的:它似乎是在MongoKit内部的某个地方触发的。你知道吗
问题是我导入了错误的类(我将父模块提供给
db.register
而不是类)。你知道吗相关问题 更多 >
编程相关推荐