Skip to content Skip to sidebar Skip to footer

Programmingerror: Relation 'blah Blah' Does Not Exist, Trying To Run The Specific Migration And Get Error

I am getting an error: $ python manage.py migrate swsite 0023_hitcounter.py Traceback (most recent call last): File 'manage.py', line 10, in execute_from_comma

Solution 1:

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.

classIndexView(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.

Post a Comment for "Programmingerror: Relation 'blah Blah' Does Not Exist, Trying To Run The Specific Migration And Get Error"