Python “django关系”;账户“用户”;heroku上载后不存在

Python “django关系”;账户“用户”;heroku上载后不存在,python,django,python-3.x,heroku,django-models,Python,Django,Python 3.x,Heroku,Django Models,我成功地将我的Django web应用程序上传到Heroku,登录页面如预期般出现 但当我尝试登录时,我发现以下错误: relation "accounts_user" does not exist LINE 1: ...ser"."is_active", "accounts_user"."is_staff" FROM "accounts_... 当我试图通过键入来访问ulrs时,也会出现此错误 cursor“\u django\u curs\u 14006295079296\u sync\u

我成功地将我的Django web应用程序上传到Heroku,登录页面如预期般出现 但当我尝试登录时,我发现以下错误:

relation "accounts_user" does not exist
LINE 1: ...ser"."is_active", "accounts_user"."is_staff" FROM "accounts_...
当我试图通过键入来访问
ulrs
时,也会出现此错误

cursor“\u django\u curs\u 14006295079296\u sync\u 1”不存在

我不知道这个错误是从哪里产生的。但我使用的是自定义用户模型,我似乎有错误

这是我使用的自定义用户模型


你在服务器上运行了
python manage.py migrate
吗?@iliya我怎么能用这样的命令运行
heroku run python manage.py migrate
,或者你可以登录到你的项目(
heroku login
),然后运行这个
heroku run bash-a你的项目名
,然后运行上面的命令。@iliya谢谢你救了我。但当我尝试从其他设备访问web时,它会重定向到Heroku页面,并显示“这里什么都没有,Yewl完成了”。对于第二个问题,我建议搜索一下,因为这个问题有很多原因,我搜索了一下,至少找到了两三个。看看这个[]。另外,请投票支持正确答案。您是否在服务器上运行了
python manage.py migrate
?@iliya我如何使用这样的命令运行
heroku run python manage.py migrate
,或者您可以登录到您的项目(
heroku login
)然后运行这个
heroku运行bash-a你的项目名
,然后运行上面的命令。@iliya谢谢你救了我。但当我尝试从其他设备访问web时,它会重定向到Heroku页面,并显示“这里什么都没有,Yewl完成了”。对于第二个问题,我建议搜索一下,因为这个问题有很多原因,我搜索了一下,至少找到了两三个。看看这个[]。也感谢投票选出正确答案。
class UserManager(BaseUserManager):
    use_in_migrations = True

    def _create_user(self, email, password, **extra_fields):
        """
        Creates and saves a User with the given email and password.
        """
        if not email:
            raise ValueError('The given email must be set')
        email = self.normalize_email(email)
        user = self.model(email=email, **extra_fields)
        user.set_password(password)
        user.save(using=self._db)
        return user

    def create_user(self, email, password=None, **extra_fields):
        extra_fields.setdefault('is_superuser', False)
        return self._create_user(email, password, **extra_fields)

    def create_superuser(self, email, password, **extra_fields):
        extra_fields.setdefault('is_superuser', True)

        if extra_fields.get('is_superuser') is not True:
            raise ValueError('Superuser must have is_superuser=True.')

        return self._create_user(email, password, **extra_fields) 

class User(AbstractBaseUser, PermissionsMixin):
    email = models.EmailField( unique=True)
    name = models.CharField(max_length=200, null=True)
    staffType = models.ForeignKey(staffType, null=True, on_delete= models.SET_NULL)
    date_joined = models.DateTimeField( auto_now_add=True)
    is_active = models.BooleanField(default=True)
    is_staff = models.BooleanField( default=True)

    objects = UserManager()

    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = []

    class Meta:
        verbose_name = 'user'
        verbose_name_plural = 'users'


    def email_user(self, subject, message, from_email=None, **kwargs):
        '''
        Sends an email to this User.
        '''
        send_mail(subject, message, from_email, [self.email], **kwargs)