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.