0

我在升级到 Django 1.11 版时遇到了这个问题。这是我为 Djagno auth 用户模型得到的错误列表。

File "/customer/models/customer.py"
    from django.contrib.auth.models import User
File "/environment/lib/python2.7/site-packages/django/contrib/auth/models.py"
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/environment/lib/python2.7/site-packages/django/contrib/auth/base_user.py"
    class AbstractBaseUser(models.Model):
File "/environment/lib/python2.7/site-packages/django/db/models/base.py"
    app_config = apps.get_containing_app_config(module)
File "/environment/lib/python2.7/site-packages/django/apps/registry.py"
    self.check_apps_ready()
File "/environment/lib/python2.7/site-packages/django/apps/registry.py", in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")

我试过 get_user_model() 代替“import User”,但得到了相同的“AppRegistryNotReady('Apps are not loaded yet.')”错误。

提前感谢您的建议。

编辑:在安装应用程序列表后添加 Djagno.setup() 后。我有这个错误: RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

4

0 回答 0