Search code examples
pythondjangodjongo

Django with Djongo, EmbeddedFields returns Models aren't loaded yet


I have a new Django project setup. I have only one package installed Djongo. And i have a local MongoDB running.

If I write a simple model with just CharFields in models.py in my app the migration works fine. But when I use EmbeddedFields it returns an error. I've copied the code from the Djongo documentation to test with code that should work. Code Source

This is what I have in my models.py:

from djongo import models

class Blog(models.Model):
    name = models.CharField(max_length=100)
    tagline = models.TextField()

    class Meta:
        abstract = True

class Entry(models.Model):
    _id = models.ObjectIdField()
    blog = models.EmbeddedField(
        model_container=Blog
    )

    headline = models.CharField(max_length=255)    
    objects = models.DjongoManager()

Error message when running py manage.py makemigrations

File "C:\Users\FelixEklöf\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py", line 178, in get_models
        self.check_models_ready()

File "C:\Users\FelixEklöf\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py", line 140, in check_models_ready
raise AppRegistryNotReady("Models aren't loaded yet.")

django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.

Solution

  • Hi which version you were using? I used 1.3.2 and had the same problem. It was gone when I downgraded it to 1.3.1