I use a hosted DB in Digital Ocean over private networking.
The private network IP is 10.138.x.x.
When I try to use the Django ORM to get an object I get:
/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py in connect(dsn, connection_factory, cursor_factory, **kwargs)
124
125 dsn = _ext.make_dsn(dsn, **kwargs)
--> 126 conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
127 if cursor_factory is not None:
128 conn.cursor_factory = cursor_factory
OperationalError: could not translate host name ""10.138.x.x"" to address: Name or service not known
However, when calling psycopg.connect with the same parameters a connection object is returned both when using the ID and the Hostname.
In [17]: psycopg2.connect(host='private-x.db.ondigitalocean.com', port='xxxx', user='xxxx', dbname='xxxx', password='xxxxx')
Out[17]: <connection object at 0x7fd1bebd38d0; dsn: 'user=doadmin password=xxx dbname=x host=private-x.db.ondigitalocean.com port=25060', closed: 0>
In [18]: psycopg2.connect(host='10.138.x.x', port='xxxx', user='xxxx', dbname='xxxxx', password='xxxxxx')
Out[18]: <connection object at 0x7fd1bebd3a08; dsn: 'user=xxxx password=xxx dbname=xxxx host=10.138.x.x port=xxxx', closed: 0>
I use a hosted DB in Digital Ocean over private networking.
The private network IP is 10.138.x.x.
When I try to use the Django ORM to get an object I get:
However, when calling
psycopg.connect
with the same parameters a connection object is returned both when using the ID and the Hostname.Any assistance will be appreciated.