質問

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