Home > OS >  django connect remote postgresql
django connect remote postgresql

Time:02-09

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.

CodePudding user response:

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>'
  •  Tags:  
  • Related