ProgrammingError: relation 'blah blah' does not exist, trying to run the specific migration and get error

岁酱吖の 提交于 2019-11-28 14:38:51

The traceback is showing you that the error is occuring in IndexView. You are trying to create objects in the database when the view loads.

class IndexView(TemplateView):
    newhit = HitCounter.objects.create()  # remove this line
    ...

Accessing the database when the views load like this is a bad idea, so you should probably remove the line. In production, it gives you the error because it is trying to create the object in the database before you have applied the migration that creates the table.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!