MerrinX
MerrinX

Reputation: 183

django connect remote postgresql

Trying to connect to a remote server, serving my posgresql

My settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'mydatabase',
        'USER': 'mydatabaseuser',
        'PASSWORD': 'mypassword',
        'HOST': '[email protected]',
        'PORT': '5432',
    }
}

Getting error:

django.db.utils.OperationalError: could not translate host name "[email protected]" to address: Name or service not known

Where the hostname and host is of course not hostname and host, just using for this example.

Upvotes: 1

Views: 655

Answers (1)

Arun T
Arun T

Reputation: 1610

For the host, you have to pass the ip address or the domain name of your postgresql host instance.

'HOST': 'host.com'

or

'HOST': '<ip_address>'

Upvotes: 1

Related Questions