2
我用dangang使用mongoengine。我有兩個模型的應用程序。參考現場在mongoengine
app1/models.py
:
from mongoengine import fields
from mongoengine.document import Document
class Model1(Document):
name = fields.StringField()
lists = fields.ListField(fields.ReferenceField("Model2", dbref=False))
app2/models.py
:
from mongoengine import fields
from mongoengine.document import Document
class Model2(Document):
name = fields.StringField()
的所有應用程序被添加到INSTALLED_APPS
。當我使用django dev-server時,一切都很好。但是使用這個代碼與uwsgi-server有一個錯誤:
Model2 has not been registered in the document registry.
Importing the document class automatically registers it, has it
been imported?
我該怎麼辦?
是的!我在'__init__'中導入了所有模型,這很有用,謝謝。 –