2

Followed this tutorial. But the password authentication was not working in django on the localhost.

Here is how I am trying to do it settings.py

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'my_local_db',
    'USER': 'admin',
    'PASSWORD': 'mypassword',
    'HOST': 'localhost',
}

}

Created a database named my_local_db with the password mypassword and created a user named admin. Granted it all the priveleges. But it gave the authentication error.

Found this so altered the user and restarted postgresql service but that didn't work either.

Also found this so updated my pg_hba.conf located at /etc/postgresql/10/main/pg_hba.conf and restarted the postgresql service.

This is how it looks:

local   all             postgres                                peer
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

Also tried adding admin as a user but that didn't work either

Update: Tried connecting using pgadmin to the database. it gave the same password authentication error.

3
  • This is not just a django issue. More easy if you try to connect from psql and post the error ( without django ) Commented Mar 31, 2018 at 13:56
  • @danihp Tried connecting to psql using pgadmin. It does not work either. Commented Mar 31, 2018 at 14:25
  • yea, more easy to get a solution just asking for postgesql issue not by django issue ( I guess ) Commented Mar 31, 2018 at 14:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.