Docker Community Forums

Share and learn in the Docker community.

Django app connection with postgresql

docker

(Iotplatform) #1

i done setup of django + postgres and created images and after that i got some problem that django showing :

**_**_f07d7ee04b38_test_try_db_1_8ad822d32c35 | 2018-11-11 08:46:32.597 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432_**_**

_ f07d7ee04b38_test_try_db_1_8ad822d32c35 | 2018-11-11 08:46:32.597 UTC [1] LOG: listening on IPv6 address “::”, port 5432_
_ f07d7ee04b38_test_try_db_1_8ad822d32c35 | 2018-11-11 08:46:32.704 UTC [1] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”_
_ f07d7ee04b38_test_try_db_1_8ad822d32c35 | 2018-11-11 08:46:33.023 UTC [25] LOG: database system was shut down at 2018-11-11 08:42:16 UTC_
_ f07d7ee04b38_test_try_db_1_8ad822d32c35 | 2018-11-11 08:46:33.141 UTC [1] LOG: database system is ready to accept connections_
_ web_1_dfd2235afe49 | /usr/local/lib/python3.7/site-packages/psycopg2/init.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use “pip install psycopg2-binary” instead. For details see: http://initd.org/psycopg/docs/install.html#binary-install-from-pypi._
_ web_1_dfd2235afe49 | “”")_
_ web_1_dfd2235afe49 | /usr/local/lib/python3.7/site-packages/psycopg2/init.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use “pip install psycopg2-binary” instead. For details see: http://initd.org/psycopg/docs/install.html#binary-install-from-pypi._
_ web_1_dfd2235afe49 | “”")_
_ web_1_dfd2235afe49 | Performing system checks…_
_ _web_1_dfd2235afe49 | __
_ web_1_dfd2235afe49 | System check identified no issues (0 silenced)._
_ web_1_dfd2235afe49 | Unhandled exception in thread started by <function check_errors..wrapper at 0x7fe1b03b6d90>_
_ web_1_dfd2235afe49 | Traceback (most recent call last):_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py”, line 216, in ensure_connection_
_ web_1_dfd2235afe49 | self.connect()_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py”, line 194, in connect_
_ web_1_dfd2235afe49 | self.connection = self.get_new_connection(conn_params)_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py”, line 174, in get_new_connection_
_ web_1_dfd2235afe49 | connection = Database.connect(**conn_params)_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/psycopg2/init.py”, line 130, in connect_
_ _web_1_dfd2235afe49 | conn = connect(dsn, connection_factory=connection_factory, **kwasync)_
_ web_1_dfd2235afe49 | psycopg2.OperationalError: could not connect to server: Connection refused_
_ web_1_dfd2235afe49 | Is the server running on host “localhost” (127.0.0.1) and accepting_
_ web_1_dfd2235afe49 | TCP/IP connections on port 5432?_
_ web_1_dfd2235afe49 | could not connect to server: Cannot assign requested address_
_ web_1_dfd2235afe49 | Is the server running on host “localhost” (::1) and accepting_
_ web_1_dfd2235afe49 | TCP/IP connections on port 5432?_
_ _web_1_dfd2235afe49 | __
_ _web_1_dfd2235afe49 | __
_ web_1_dfd2235afe49 | The above exception was the direct cause of the following exception:_
_ _web_1_dfd2235afe49 | __
_ web_1_dfd2235afe49 | Traceback (most recent call last):_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py”, line 225, in wrapper_
_ web_1_dfd2235afe49 | fn(*args, **kwargs)_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/core/management/commands/runserver.py”, line 120, in inner_run_
_ web_1_dfd2235afe49 | self.check_migrations()_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/core/management/base.py”, line 442, in check_migrations_
_ web_1_dfd2235afe49 | executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py”, line 18, in init_
_ web_1_dfd2235afe49 | self.loader = MigrationLoader(self.connection)_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/migrations/loader.py”, line 49, in init_
_ web_1_dfd2235afe49 | self.build_graph()_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/migrations/loader.py”, line 209, in build_graph_
_ web_1_dfd2235afe49 | self.applied_migrations = recorder.applied_migrations()_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/migrations/recorder.py”, line 61, in applied_migrations_
_ web_1_dfd2235afe49 | if self.has_table():_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/migrations/recorder.py”, line 44, in has_table_
_ _web_1_dfd2235afe49 | return self.Migration.meta.db_table in self.connection.introspection.table_names(self.connection.cursor())_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py”, line 255, in cursor_
_ _web_1_dfd2235afe49 | return self.cursor()_
_ _web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py”, line 232, in cursor_
_ web_1_dfd2235afe49 | self.ensure_connection()_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py”, line 216, in ensure_connection_
_ web_1_dfd2235afe49 | self.connect()_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/utils.py”, line 89, in exit_
_ web_1_dfd2235afe49 | raise dj_exc_value.with_traceback(traceback) from exc_value_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py”, line 216, in ensure_connection_
_ web_1_dfd2235afe49 | self.connect()_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py”, line 194, in connect_
_ web_1_dfd2235afe49 | self.connection = self.get_new_connection(conn_params)_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py”, line 174, in get_new_connection_
_ web_1_dfd2235afe49 | connection = Database.connect(**conn_params)_
_ web_1_dfd2235afe49 | File “/usr/local/lib/python3.7/site-packages/psycopg2/init.py”, line 130, in connect_
_ _web_1_dfd2235afe49 | conn = connect(dsn, connection_factory=connection_factory, **kwasync)_
_ web_1_dfd2235afe49 | django.db.utils.OperationalError: could not connect to server: Connection refused_
_ web_1_dfd2235afe49 | Is the server running on host “localhost” (127.0.0.1) and accepting_
_ web_1_dfd2235afe49 | TCP/IP connections on port 5432?_
_ web_1_dfd2235afe49 | could not connect to server: Cannot assign requested address_
_ web_1_dfd2235afe49 | Is the server running on host “localhost” (::1) and accepting_
_ web_1_dfd2235afe49 | TCP/IP connections on port 5432?_
_ web_1_dfd2235afe49 |_

  • Please help me.
  • thank you