Re: : Getting error while starting the server

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: VENKTESH GUTTEDAR <venkteshguttedar(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: : Getting error while starting the server
Date: 2015-02-23 07:25:25
Message-ID: 54EAD5E5.8070507@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-02-23 08:38:14 Re: : Getting error while starting the server
Previous Message Thomas Kellerer 2015-02-23 07:23:18 Re: Postgres architecture for multiple instances