Issue
Got this error after changing my database from sqlite to postgresql. I've made all my settings changes:
Here's my settings:
DATABASES = {
'default': {
'ENGINE': "django.db.backends.postgresql_psycopg2",
'NAME': "postr1",
'USER': "zorgan",
'PASSWORD': config('DB_PASSWORD'),
'HOST': "localhost",
'PORT': '',
}
}
as well as performing makemigrations
and migrations
which were all successful. So I'm able to succesfully start my local server:
System check identified no issues (0 silenced).
May 15, 2018 - 08:59:39
Django version 1.11.8, using settings 'draft1.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
however when I go to the site it returns this error:
ProgrammingError at /news/
relation "django_session" does not exist
LINE 1: ...ession_data", "django_session"."expire_date" FROM "django_se...
Any idea what the problem is?
Solution
Try fake migrate
to zero.
Your migration history shows that sessions
table was already made, but you don't have real table.
so following below
python manage.py migrate --fake sessions zero
# then your sessions migrate will be
python manage.py showmigrations
sessions
[ ] 0001_initial
# then migrate with --fake-initial again
python manage.py migrate --fake-initial
Then try again.
Answered By - seuling
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.