在Heroku上部署后,Django 2停止工作

时间:2019-07-27 14:53:53

标签: python django heroku django-2.0

我正在使用Django(2)开发一个项目,其中有一些模型,并且该应用程序在本地系统上正常工作。

但是当我将此应用程序部署到Heroku时,它开始返回错误,如下所示:

  

列core_votingvalueshistory.value1不存在第1行:SELECT   “ core_votingvalueshistory”。“ id”,“ core_votingvaluesshi ...                                                   ^提示:也许您打算引用“ core_votingvalueshistory.value”列。

这是导致问题的模型:

class VotingValuesHistory(models.Model):
    # id = models.AutoField(primary_key=True, auto_created=True)
    value1 = models.CharField(max_length=40)
    value2 = models.CharField(max_length=40)
    value3 = models.CharField(max_length=40)
    value4 = models.CharField(max_length=40)
    value5 = models.CharField(max_length=40)
    score1 = models.CharField(choices=VOTE_CHOICES, max_length=20)
    score2 = models.CharField(choices=VOTE_CHOICES, max_length=20)
    score3 = models.CharField(choices=VOTE_CHOICES, max_length=20)
    score4 = models.CharField(choices=VOTE_CHOICES, max_length=20)
    score5 = models.CharField(choices=VOTE_CHOICES, max_length=20)
    user = models.EmailField(max_length=255)
    group = models.CharField(max_length=250, default='notingroup')
    date = models.DateTimeField(auto_now_add=True)

,它也将我要查询对象的视图指向:

来自views.py

v1 = VotingValuesHistory.objects.all().filter()
        for item in v1:
            if item.group == groupname:
                if item.score1 == 'disaster':
                    numscore_disaster += 1
                elif item.score1 == 'meh':
                    numscore_meh += 1
                else:
                    numscore_helpful += 1

我已尝试使用以下命令makemigrationsmigrate

heroku run python manage.py makemigrations

heroku run python manage.py migrate

0 个答案:

没有答案