嘿,我是 djongo 的新手,当我不断收到此错误时,我正在练习它的用法
文件“D:\python\django Rest webs\tms-REST API\BACKEND\bckend\students\models.py”,第 6 行,课堂上的学生(models.Model):文件“D:\python\django Rest webs\ tms-REST API\BACKEND\bckend\students\models.py”,第 7 行,学生 pass_details=models.EmbeddedField(model_container=pass_details, null=True) 文件“C:\Users\Asus\AppData\Local\Programs\ Python\Python38-32\lib\site-packages\djongo\models\fields.py”,第 225 行,在init
super() 中。init (model_container, *args, **kwargs) 文件“C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\djongo\models\fields.py”,第 87 行,在初始化
self._validate_container() 文件“C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\djongo\models\fields.py”,第 91 行,_validate_container 中的字段.model_container._meta.get_fields():文件“C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\options.py”,第 734 行,在 get_fields 返回 self._get_fields(include_parents=include_parents, include_hidden=include_hidden) 文件“C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\options. py”,第 794 行,在 _get_fields all_fields = self._relation_tree 文件中“C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py”,行80、在get
res=instance。听写[self.name] = self.func(instance) 文件 "C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\options.py",第 707 行,在 _relation_tree 返回 self._populate_directed_relation_graph() 文件“C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\options.py”,行678,在_populate_directed_relation_graph
all_models = self.apps.get_models(include_auto_created=True) 文件“C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py”,第 178 行,在 get_models self.check_models_ready() 文件“C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py”中,第 140 行,在 check_models_ready 中AppRegistryNotReady("模型尚未加载。") django.core.exceptions.AppRegistryNotReady:模型尚未加载。
我的代码看起来像这样
from djongo import models
class pass_details(models.Model):
pass_no=models.CharField( max_length=20)
class Meta:
abstract = True
class student(models.Model):
pass_details=models.EmbeddedField(model_container=pass_details, null=True)
usn=models.CharField(max_length=10)
name=models.CharField(max_length=20)
objects = models.DjongoManager()