Django setting : psycopg2.OperationalError: FATAL: Peer authentication failed for user "indivo"
django, django-settings, postgresql, psycopg2, python
Solution
I have similar problem and solved it with this answer by adding `localhost` to the database `HOST` settings in settings.py, so your database settings should look like this:
DATABASES = {
'default':{
'ENGINE':'django.db.backends.postgresql_psycopg2', # '.postgresql_psycopg2', '.mysql', or '.oracle'
'NAME':'indivo', # Required to be non-empty string
'USER':'indivo', # Required to be non-empty string
'PASSWORD':'ritvik',
'HOST':'localhost', # <- Changed from empty string to localhost
'PORT':'', # Set to empty string for default.
},
}
Problem
I am getting problem in Django project setting with POSTGRESQL. Here is my setting.py database setting ``` DATABASES = { 'default':{ 'ENGINE':'django.db.backends.postgresql_psycopg2', # '.postgresql_psycopg2', '.mysql', or '.oracle' 'NAME':'indivo', # Required to be non-empty string 'USER':'indivo', # Required to be non-empty string 'PASSWORD':'ritvik', 'HOST':'', # Set to empty string for localhost. 'PORT':'', # Set to empty string for default. }, } ``` Now in postgres backend what I have done is . ``` rohit@rohit-desktop:~$ sudo su - postgres postgres@rohit-desktop:~$ createuser --superuser indivo # create a super user indivo postgres@rohit-desktop:~$ psql # open psql terminal psql (9.1.8) Type "help" for help. postgres=# \password indivo # set the password ritvik Enter new password: Enter it again: postgres=# \q #logout postgres@rohit-desktop:~$ createdb -U indivo -O indivo indivo #create db indivo ``` Unfortunately when i am trying to syncdb I am getting the error . ``` psycopg2.OperationalError: FATAL: Peer authentication failed for user "indivo" ``` Please help me out what might I am doing wrong here .