[英]ProgrammingError: relation “django_session” does not exist error after installing Psycopg2
I started to develop a Django base web application. 我开始开发一个Django基础Web应用程序。 Everything were fine until I installed
Psycopg2
for my database which I created in PstgreSql
. 直到我安装了一切都很好
Psycopg2
我的数据库,我在创建PstgreSql
。 Now when I'm trying to open any page in my site, it throws ProgrammingError: relation "django_session" does not exist
error. 现在,当我尝试在我的网站中打开任何页面时,它会抛出
ProgrammingError: relation "django_session" does not exist
错误。
Request Method: GET
Request URL: http://127.0.0.1:8000/login/
Django Version: 1.7
Exception Type: ProgrammingError
Exception Value:
relation "django_session" does not exist
LINE 1: ...ession_data", "django_session"."expire_date" FROM "django_se...
^
Exception Location: /home/alex/.virtualenvs/startDjango/local/lib/python2.7/site-packages/django/db/backends/utils.py in execute, line 65
Python Executable: /home/alex/.virtualenvs/startDjango/bin/python
This is my database setting in Setting.py
这是我在
Setting.py
数据库设置
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'myDB',
'USER': 'alex',
'PASSWORD': 'mypassword',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
I'm developing in virtualenvs
我正在开发
virtualenvs
Any idea how to fix this? 知道如何解决这个问题吗? Thanks
谢谢
If you change the database, you should create database for the new database. 如果更改数据库,则应为新数据库创建数据库。
Use manage.py migrate
command. 使用
manage.py migrate
命令。 (or manage.py syncdb
if you used it for old database). (如果您将旧数据库用于旧数据库,则为
manage.py syncdb
)。
如果您已经运行迁移并仍然收到错误,您也可以只迁移会话应用程序
python manage.py migrate sessions
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.