Postgres Authentication Fails When Starting Dajngo

0

I am in the process of restoring my Django development server to another virtual machine. I have set up Django, Postgres, installed the GIS extensions and restored the database.

When I run the server, I get the error below:

password authentication failed for user "myuser"

With "myuser" I can connect to the Postgres database as that user with the same password specified in "mysettings.py" and create and drop tables so I don't understand why it is not connecting.

My settings.py looks like this:

DATABASES = {
'default': {
    'ENGINE': 'django.contrib.gis.db.backends.postgis',
    'NAME': 'travel',
    'USER': 'myuser',
    'PASSWORD': 'Passw0rd',
    'HOST': 'localhost',
    'PORT': '',
}

}

Can someone help? It doesn't make sense to me if I can log on as that user and create / drop tables.

RLBChrisBriant

Posted 2018-12-27T07:46:52.587

Reputation: 19

Answers

0

I managed to solve this by creating a new user in postgres and using their credentials in settings.py. I needed to make that user a super user.

The previous user was a local user on the server which was linked to the postgres account so I don't understand why it didn't work in that case. Can anyone advise?

RLBChrisBriant

Posted 2018-12-27T07:46:52.587

Reputation: 19

0

It's hard to tell without a bit more information, but '' isn't a valid port number. You should probably use PostgreSQL's default port, 5432.

Mureinik

Posted 2018-12-27T07:46:52.587

Reputation: 3 521

I've tried that just and get the same error. – RLBChrisBriant – 2018-12-27T12:13:17.913

On other servers I haven't specified a port no. and it's been fine. – RLBChrisBriant – 2018-12-27T12:13:42.590