On 02/22/2015 11:02 PM, VENKTESH GUTTEDAR wrote:
Hello,
i have Postgresql 9.3.5 installed and django 1.7 and till now it
was working fine.
But now i am getting the following error while starting the server
to run my app :
Unhandled exception in thread started by <function
check_errors.<locals>.wrapper at 0xb2da8074>
Traceback (most recent call last):
File
"/usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py",
line 133, in ensure_connection
self.connect()
File
"/usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py",
line 122, in connect
self.connection = self.get_new_connection(conn_params)
File
"/usr/local/lib/python3.4/dist-packages/django/db/backends/postgresql_psycopg2/base.py",
line 134, in get_new_connection
return Database.connect(**conn_params)
File "/usr/local/lib/python3.4/dist-packages/psycopg2/__init__.py",
line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory,
async=async)
psycopg2.OperationalError: could not translate host name "localhost" to
address: Name or service not known
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File
"/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py",
line 222, in wrapper
fn(*args, **kwargs)
File
"/usr/local/lib/python3.4/dist-packages/django/core/management/commands/runserver.py",
line 107, in inner_run
self.check_migrations()
File
"/usr/local/lib/python3.4/dist-packages/django/core/management/commands/runserver.py",
line 159, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File
"/usr/local/lib/python3.4/dist-packages/django/db/migrations/executor.py",
line 17, in __init__
self.loader = MigrationLoader(self.connection)
File
"/usr/local/lib/python3.4/dist-packages/django/db/migrations/loader.py",
line 48, in __init__
self.build_graph()
File
"/usr/local/lib/python3.4/dist-packages/django/db/migrations/loader.py",
line 183, in build_graph
self.applied_migrations = recorder.applied_migrations()
File
"/usr/local/lib/python3.4/dist-packages/django/db/migrations/recorder.py",
line 59, in applied_migrations
self.ensure_schema()
File
"/usr/local/lib/python3.4/dist-packages/django/db/migrations/recorder.py",
line 49, in ensure_schema
if self.Migration._meta.db_table in
self.connection.introspection.get_table_list(self.connection.cursor()):
File
"/usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py",
line 165, in cursor
cursor = self.make_debug_cursor(self._cursor())
File
"/usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py",
line 138, in _cursor
self.ensure_connection()
File
"/usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py",
line 133, in ensure_connection
self.connect()
File "/usr/local/lib/python3.4/dist-packages/django/db/utils.py",
line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py",
line 658, in reraise
raise value.with_traceback(tb)
File
"/usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py",
line 133, in ensure_connection
self.connect()
File
"/usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py",
line 122, in connect
self.connection = self.get_new_connection(conn_params)
File
"/usr/local/lib/python3.4/dist-packages/django/db/backends/postgresql_psycopg2/base.py",
line 134, in get_new_connection
return Database.connect(**conn_params)
File "/usr/local/lib/python3.4/dist-packages/psycopg2/__init__.py",
line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory,
async=async)
django.db.utils.OperationalError: could not translate host name
"localhost" to address: Name or service not known
can anyone tell me what is the reason for this error.?
Should have added, this is a generic connection error, below Django and
even psycopg2 for that matter. To solve I would work up the ladder:
1) Try a psql connection. My guess is it will fail.
2) If it does not, try a straight psycopg2 connection.
3) If step 2 does not fail, then try the Django app.
--
Regards :
Venktesh Guttedar.
--
Adrian Klaver
adrian.kla...@aklaver.com
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general