/ / Django + Psycopg2:InterfaceError:プロトコル3のみサポート - django、postgresql

Django + Psycopg2:InterfaceError:プロトコル3のみサポート - django、postgresql

私のDjango + Postgresqlの設定でページを読み込むときに時々このエラーが発生することがあります。

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.
}
}

回答:

回答№1の場合は-1

http://initd.org/psycopg/docs/connection.html#connection.protocol_version

あなたは使用しているポストグラムのバージョンを提供していませんでした。
それは7.4より古いと思われる。 その場合、解決策はpostgresのバージョンをアップグレードすることです
(またはpsycopgの古いバージョンをインストールしますが、私はそれがうまくいかないと思います)