当在我的Django + Postgresql设置中加载页面时,我偶尔会得到这个错误,但不是一直都是:
连接中的psycopg2
InterfaceError:仅支持协议3
psycopg2/__init__.py ? in connect
raise TypeError('missing dsn and no parameters')
else:
dsn = " ".join(["%s=%s" % (k, _param_escape(str(v)))
for (k, v) in items])
conn = _connect(dsn, connection_factory=connection_factory, async=async)
if cursor_factory is not None:
conn.cursor_factory = cursor_factory
return conn我完全不知道是什么导致了这一切。
我的production.py设置文件:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mydbname', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'myuser',
'PASSWORD': 'mypassword',
'HOST': 'localhost', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}发布于 2014-08-10 22:26:58
http://initd.org/psycopg/docs/connection.html#connection.protocol_version
您没有提供您正在使用的postgres版本。
看起来比7.4还老。在这种情况下,解决方案是升级postgres版本
(或者安装旧版本的install,但我认为它不太好)
https://stackoverflow.com/questions/25216465
复制相似问题