Re: : Getting error while starting the server - Mailing list pgsql-general

From Adrian Klaver
Subject Re: : Getting error while starting the server
Date
Msg-id 54EAD5E5.8070507@aklaver.com
Whole thread Raw
In response to : Getting error while starting the server  (VENKTESH GUTTEDAR <venkteshguttedar@gmail.com>)
List pgsql-general
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.?

What OS and what version?

Would be nice to see the DSN you are using?

Though I suspect is the issue is that localhost is not defined in your
hosts file.

Have you tried using 127.0.0.1 instead of localhost to test?

>
> --
> Regards :
> Venktesh Guttedar.
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Postgres architecture for multiple instances
Next
From: Adrian Klaver
Date:
Subject: Re: : Getting error while starting the server