名称错误: 未定义名称'AUTH'


from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin

class User(AbstractBaseUser, PermissionsMixin):
email = models.EmailField(unique=True)
name = models.CharField(max_length=150)
objects = UserManager()
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['name',]
def __str__(self):
return self.email

当我运行makemigration时,得到这个错误:

File "/app/core/settings.py", line 133, in <module>
AUTH
NameError: name 'AUTH' is not defined

在settings.py文件的末尾我添加了:

AUTH_USER_MODEL = 'accounts.User'

容器已停止。我重新启动容器并再次运行python manage.py makemigrations,错误消失了。

相关内容

  • 没有找到相关文章

最新更新