문제

error to set postgresql9.3 in the Django1.6.

I have installed postgresql, psycopg2 and Django.

my code : settings.py :

 DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': os.path.join(BASE_DIR, 'db.psycopg3'),
        'USER': 'root',
        'PASSWORD': 'root',
        'HOST': '127.0.0.1',
        'PORT': '5432',
         }
   }

and to python manage.py shell :

from django.db import connection
cursor = connection.cursor()

Errors :

FATAL:  password authentication failed for user "root"

Please help...

도움이 되었습니까?

해결책

The database name in your settings.py should be modified. Actually you had entered the format used for sqlite db. For postgres, it should be

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'dbname',
    'USER': 'root',
    'PASSWORD': 'rootXXX',
    'HOST': '',
    'PORT': '',
}
}

Create the Database 'dbname' in your postgres before synchronizing it with your app

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top