Q&A

책을 따라하다가 막히는 부분이 있나요?
질문을 남겨주세요.

p575, database "do_it_django_dev" does not exist 오류

2 years, 5 months ago

lee2 lee2

오류가 나네요


C:\_Dev\github\do_it_django_a_to_z(main -> origin)

(venv) λ dodocker-compose up

Creating network "do_it_django_a_to_z_default" with the default driver

Creating volume "do_it_django_a_to_z_postgres_data" with default driver

Creating do_it_django_a_to_z_db_1 ... done

Creating do_it_django_a_to_z_web_1 ... done

Attaching to do_it_django_a_to_z_db_1, do_it_django_a_to_z_web_1

db_1   | The files belonging to this database system will be owned by user "postgres".

db_1   | This user must also own the server process.

db_1   |

db_1   | The database cluster will be initialized with locale "en_US.utf8".

db_1   | The default database encoding has accordingly been set to "UTF8".

db_1   | The default text search configuration will be set to "english".

db_1   |

db_1   | Data page checksums are disabled.

db_1   |

db_1   | fixing permissions on existing directory /var/lib/postgresql/data ... ok

db_1   | creating subdirectories ... ok

db_1   | selecting dynamic shared memory implementation ... posix

db_1   | selecting default max_connections ... 100

db_1   | selecting default shared_buffers ... 128MB

db_1   | selecting default time zone ... UTC

db_1   | creating configuration files ... ok

db_1   | running bootstrap script ... ok

db_1   | performing post-bootstrap initialization ... sh: locale: not found

db_1   | 2022-05-11 16:13:05.310 UTC [27] WARNING:  no usable system locales were found

db_1   | ok

db_1   | syncing data to disk ... initdb: warning: enabling "trust" authentication for local connections

db_1   | You can change this by editing pg_hba.conf or using the option -A, or

db_1   | --auth-local and --auth-host, the next time you run initdb.

db_1   | ok

db_1   |

db_1   |

db_1   | Success. You can now start the database server using:

db_1   |

db_1   |     pg_ctl -D /var/lib/postgresql/data -l logfile start

db_1   |

db_1   | waiting for server to start....2022-05-11 16:13:05.844 UTC [31] LOG:  starting PostgreSQL 12.0 on x86_64-pc-linux-musl, compiled by gcc (Alpine 8.3.0) 8.3.0, 64-bit

db_1   | 2022-05-11 16:13:05.848 UTC [31] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"

db_1   | 2022-05-11 16:13:05.865 UTC [32] LOG:  database system was shut down at 2022-05-11 16:13:05 UTC

db_1   | 2022-05-11 16:13:05.869 UTC [31] LOG:  database system is ready to accept connections

db_1   |  done

db_1   | server started

db_1   | CREATE DATABASE

db_1   |

db_1   |

db_1   | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

db_1   |

db_1   | waiting for server to shut down...2022-05-11 16:13:06.051 UTC [31] LOG:  received fast shutdown request

db_1   | .2022-05-11 16:13:06.055 UTC [31] LOG:  aborting any active transactions

db_1   | 2022-05-11 16:13:06.056 UTC [31] LOG:  background worker "logical replication launcher" (PID 38) exited with exit code 1

db_1   | 2022-05-11 16:13:06.056 UTC [33] LOG:  shutting down

db_1   | 2022-05-11 16:13:06.074 UTC [31] LOG:  database system is shut down

db_1   |  done

db_1   | server stopped

db_1   |

db_1   | PostgreSQL init process complete; ready for start up.

db_1   |

db_1   | 2022-05-11 16:13:06.160 UTC [1] LOG:  starting PostgreSQL 12.0 on x86_64-pc-linux-musl, compiled by gcc (Alpine 8.3.0) 8.3.0, 64-bit

db_1   | 2022-05-11 16:13:06.160 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432

db_1   | 2022-05-11 16:13:06.160 UTC [1] LOG:  listening on IPv6 address "::", port 5432

db_1   | 2022-05-11 16:13:06.165 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"

db_1   | 2022-05-11 16:13:06.180 UTC [42] LOG:  database system was shut down at 2022-05-11 16:13:06 UTC

db_1   | 2022-05-11 16:13:06.184 UTC [1] LOG:  database system is ready to accept connections

web_1  | Watching for file changes with StatReloader

web_1  | Performing system checks...

web_1  |

web_1  | System check identified no issues (0 silenced).

db_1   | 2022-05-11 16:13:08.886 UTC [49] FATAL:  database "do_it_django_dev" does not exist

web_1  | Exception in thread django-main-thread:

web_1  | Traceback (most recent call last):

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection

web_1  |     self.connect()

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner

web_1  |     return func(*args, **kwargs)

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect

web_1  |     self.connection = self.get_new_connection(conn_params)

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner

web_1  |     return func(*args, **kwargs)

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection

web_1  |     connection = Database.connect(**conn_params)

web_1  |   File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect

web_1  |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)

web_1  | psycopg2.OperationalError: connection to server at "db" (172.21.0.2), port 5432 failed: FATAL:  database "do_it_django_dev" does not exist

web_1  |

web_1  |

web_1  | The above exception was the direct cause of the following exception:

web_1  |

web_1  | Traceback (most recent call last):

web_1  |   File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner

web_1  |     self.run()

web_1  |   File "/usr/local/lib/python3.8/threading.py", line 870, in run

web_1  |     self._target(*self._args, **self._kwargs)

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper

web_1  |     fn(*args, **kwargs)

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 121, in inner_run

web_1  |     self.check_migrations()

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 486, in check_migrations

web_1  |     executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/migrations/executor.py", line 18, in __init__

web_1  |     self.loader = MigrationLoader(self.connection)

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/migrations/loader.py", line 53, in __init__

web_1  |     self.build_graph()

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/migrations/loader.py", line 220, in build_graph

web_1  |     self.applied_migrations = recorder.applied_migrations()

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/migrations/recorder.py", line 77, in applied_migrations

web_1  |     if self.has_table():

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/migrations/recorder.py", line 55, in has_table

web_1  |     with self.connection.cursor() as cursor:

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner

web_1  |     return func(*args, **kwargs)

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 259, in cursor

web_1  |     return self._cursor()

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor

web_1  |     self.ensure_connection()

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner

web_1  |     return func(*args, **kwargs)

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection

web_1  |     self.connect()

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__

web_1  |     raise dj_exc_value.with_traceback(traceback) from exc_value

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection

web_1  |     self.connect()

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner

web_1  |     return func(*args, **kwargs)

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect

web_1  |     self.connection = self.get_new_connection(conn_params)

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner

web_1  |     return func(*args, **kwargs)

web_1  |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection

web_1  |     connection = Database.connect(**conn_params)

web_1  |   File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect

web_1  |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)

web_1  | django.db.utils.OperationalError: connection to server at "db" (172.21.0.2), port 5432 failed: FATAL:  database "do_it_django_dev" does not exist


lee2
lee2   2 years, 5 months ago

원인 찾았습니다.

다음에서 오타 쳤네요.

 environment:
      - POSTGRES_DB

Updated: May 14, 2022, 12:12 p.m.

Leave a Comment:
목록보기
Search
  • 자유게시판
  • Q&A