I used sqlite3 during development, then changed my database settings to postgresql:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'test2',
'USER': 'postgres',
'PASSWORD': 'aman',
'HOST': 'localhost',
'PORT': '5432',
}
}
Regardless of any command I write, it gives me the error:
django.db.utils.ProgrammingError: relation "taksist_category" does not exist
LINE 1: ...st_category"."id", "taksist_category"."name" FROM "taksist_c...
Category model exists inside taksist application. If I take back my database settings to sqlite3, then application runs successfully.
I cannot even run my server. Even if there is a problem with my model taksist/Category, my application should run. Here strange thing is whatever command is written, I got this error. I cannot do makemigrations, migrate, runserver.
What did I do to solve the issue:
- deleted migrations folder, and tried makemigrations
- I created empty migrations folder with init.py inside, and tried makemigrations
- python manage.py migrate --fake
none of above worked.
Here is taksist.category model, in case.
class Category(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length = 20)
def __str__(self):
return self.name
Any help of yours is appreciated. thank you in advance.
python manage.py migrate