1
votes

I am using PostGRE sql in my localhost in Django 1.10.1 and have installed all dependencies, psycopg2, postgresql, pgadmin3 and have set the password of postgresql via command line. I've used exactly the same password in settings.py of the django project. Still I am being shown the authentication error. I am using pyvenv virtual environment with python 3.5.2

Please check the error code below:

Traceback (most recent call last):

File "/home/jayesh/django/myproject/lib/python3.5/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection self.connect() File "/home/jayesh/django/myproject/lib/python3.5/site-packages/django/db/backends/base/base.py", line 171, in connect self.connection = self.get_new_connection(conn_params) File "/home/jayesh/django/myproject/lib/python3.5/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection connection = Database.connect(**conn_params) File "/home/jayesh/django/myproject/lib/python3.5/site-packages/psycopg2/init.py", line 164, in connect conn = _connect(dsn, connection_factory=connection_factory, async=async) psycopg2.OperationalError: FATAL: password authentication failed for user "postgresql" FATAL: password authentication failed for user "postgresql"

The settings.py contains the following reg DB:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'myproject',
        'USER': 'postgresql',
        'PASSWORD': 'mypassword',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}

Please guide regarding the above issue.

I've already followed the following links: Django setting : psycopg2.OperationalError: FATAL: Peer authentication failed for user "indivo"

ImportError: No module named psycopg2

How connect Postgres to localhost server using pgAdmin on Ubuntu?

1
did you create the postgres user that you are using(in psql)? does the database myproject exist? does the user have permission to create tables in the myproject database? is that the right password?Joran Beasley
@JoranBeasley yes the user is created. Database exists. It's the default PostgreSQL user. Yes it's the right password.Jayesh

1 Answers

0
votes

Looks like psycopg2 also had its own dependencies that were not properly installed for me.

Also the default username of is not postgresql but its just postgres

Both of the above checks gave me the solution required and django 1.10 server is up and running now.