Postgres and Django - Postgres User won't authenticate
I'd like to check my steps for creating a user for postgres and then allowing that user to authenticate form django to postgres and do teh database work.
SU to postgres. $ su - postgres
As postgres, create a database. $ createdb dbname
As postgres, login to dbname. $ psql -d dbname -U postgres
Create the DB user: $ CREATE USER awesome PASSWORD 'something';
Using CREATE USER assigns login to that user.
That all works. But the only way to actually authenticate to the database is to su to that user.
Now, I add that user, database and password to my Django settings.py file. But when I try to syncdb, I get:
Ident authentication failed for user "awesome"
In my stack trace.
I'm confused what I'm missing. Any suggestions would be welcome. DO I have to set up authentication on my server with postgres?
Dave
1 Reply
One, you created the database as the user postgres, owned by postres, rather than as your awesome user, so you'll need to use the grant sql command to give rights to the awesome user.
What i used to do was use the createuser command, then createdb command with a switch to say create the db as user (eg) awesome.
Two, you probably need to look at a file called pghba.something (pghba.conf?) hiding somewhere in /etc. try
find /etc/ -name pg_hba.*