Форум сайта python.su
Вот тут сказано чтоб посмотреть правильность настройки с БД, нужно ввести:
>>> from django.db import connection
>>> cursor = connection.cursor()
>>> from django.db import connection
>>> cursor = connection.cursor()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/__init__.py", line 81, in cursor
cursor = self._cursor()
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 98, in _cursor
self.connection = Database.connect(**conn_params)
OperationalError: FATAL: Ident authentication failed for user "nr_user"
DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'nr_db' # Or path to database file if using sqlite3.
DATABASE_USER = 'nr_user' # Not used with sqlite3.
DATABASE_PASSWORD = 'jkz' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '5432' # Set to empty string for default. Not used with sqlite3.
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
Отредактировано (Май 6, 2010 18:52:58)
Офлайн
onetwoв settings.py стоит пользователь nr_user,а в postgres какой пользователь?базы?наверно там стоит postgres,надо тоже изменить на nr_user и тогда подключаться
Вот тут сказано чтоб посмотреть правильность настройки с БД, нужно ввести:и ничего не должно произойти. у меня же ошибка:>>> from django.db import connection
>>> cursor = connection.cursor()>>> from django.db import connection
>>> cursor = connection.cursor()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/__init__.py", line 81, in cursor
cursor = self._cursor()
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 98, in _cursor
self.connection = Database.connect(**conn_params)
OperationalError: FATAL: Ident authentication failed for user "nr_user"
Офлайн
таки да, спасибо.
Офлайн
Господа, у меня та же беда.
settings.py
DATABASES = {
...
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'postgres', # Or path to database file if using sqlite3.
'USER': 'postgres', # Not used with sqlite3.
'PASSWORD': 'pswd', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
...
>>> from django.db import connection
>>> cursor = connection.cursor()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/__init__.py", line 75, in cursor
cursor = self._cursor()
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 136, in _cursor
self.connection = Database.connect(**conn_params)
OperationalError: FATAL: Ident authentication failed for user "postgres"
Отредактировано (Сен. 11, 2010 10:34:57)
Офлайн
Ну блин, почитай доку на тему “Ident authentication”.
В данном случае скорее всего будет достаточно указать хост и порт явно, чтобы он не через unix socket коннектился.
Офлайн
ZZZОк. Спасибо.
Ну блин, почитай доку на тему “Ident authentication”.
В данном случае скорее всего будет достаточно указать хост и порт явно, чтобы он не через unix socket коннектился.
Офлайн
Для разработки я обычно ставлю
host all all 127.0.0.1/32 trust
А вообще про настройку смотрите http://www.postgresql.org/docs/8.1/interactive/client-authentication.html
Офлайн
ZZZПрописал порт “5432” и помогло. Выглядит вот так все теперь.
Ну блин, почитай доку на тему “Ident authentication”.
В данном случае скорее всего будет достаточно указать хост и порт явно, чтобы он не через unix socket коннектился.
Офлайн