не создается
Ну ты уверен, то что ты написал, это создаст твоё бд?
ну, в других проектах то же самое прописано, нормально работает. разве что environments прямо в композе, а здесь в файлик вынес
https://zhao-li.medium.com/getting-started-with-postgresql-using-docker-compose-34d6b808c47c
Вместо : поставь =
энивей не работает
В логах что?
invite_postgres | invite_postgres | PostgreSQL Database directory appears to contain a database; Skipping initialization invite_postgres | invite_postgres | 2021-11-10 17:02:10.950 UTC [1] LOG: starting PostgreSQL 13.4 (Debian 13.4-4.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit invite_postgres | 2021-11-10 17:02:10.951 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 invite_postgres | 2021-11-10 17:02:10.951 UTC [1] LOG: listening on IPv6 address "::", port 5432 invite_postgres | 2021-11-10 17:02:11.049 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" invite_postgres | 2021-11-10 17:02:11.195 UTC [26] LOG: database system was shut down at 2021-11-10 16:59:27 UTC invite_postgres | 2021-11-10 17:02:11.310 UTC [1] LOG: database system is ready to accept connections invite_tg | DEBUG:asyncio:Using selector: EpollSelector invite_tg | DEBUG:tortoise:Tortoise-ORM startup invite_tg | connections: {'default': 'postgres://dadyarri:mjr***@invite_postgres:5432/invitebot'} invite_tg | apps: {'models': {'models': ['database.models', 'aerich.models']}} invite_postgres | 2021-11-10 17:02:14.258 UTC [33] FATAL: database "invitebot" does not exist invite_tg | Traceback (most recent call last): invite_tg | File "/usr/local/lib/python3.9/site-packages/tortoise/backends/asyncpg/client.py", line 103, in create_connection invite_tg | self._pool = await asyncpg.create_pool(None, password=self.password, **self._template) invite_tg | File "/usr/local/lib/python3.9/site-packages/asyncpg/pool.py", line 407, in _async__init__ invite_tg | await self._initialize() invite_tg | File "/usr/local/lib/python3.9/site-packages/asyncpg/pool.py", line 435, in _initialize invite_tg | await first_ch.connect() invite_tg | File "/usr/local/lib/python3.9/site-packages/asyncpg/pool.py", line 127, in connect invite_tg | self._con = await self._pool._get_new_connection() invite_tg | File "/usr/local/lib/python3.9/site-packages/asyncpg/pool.py", line 477, in _get_new_connection invite_tg | con = await connection.connect( invite_tg | File "/usr/local/lib/python3.9/site-packages/asyncpg/connection.py", line 2045, in connect invite_tg | return await connect_utils._connect( invite_tg | File "/usr/local/lib/python3.9/site-packages/asyncpg/connect_utils.py", line 776, in _connect invite_tg | return await _connect_addr( invite_tg | File "/usr/local/lib/python3.9/site-packages/asyncpg/connect_utils.py", line 676, in _connect_addr invite_tg | return await __connect_addr(params, timeout, True, *args) invite_tg | File "/usr/local/lib/python3.9/site-packages/asyncpg/connect_utils.py", line 726, in __connect_addr invite_tg | await compat.wait_for(connected, timeout=timeout) invite_tg | File "/usr/local/lib/python3.9/site-packages/asyncpg/compat.py", line 66, in wait_for invite_tg | return await asyncio.wait_for(fut, timeout) invite_tg | File "/usr/local/lib/python3.9/asyncio/tasks.py", line 481, in wait_for invite_tg | return fut.result() invite_tg | asyncpg.exceptions.InvalidCatalogNameError: database "invitebot" does not exist invite_tg | invite_tg | During handling of the above exception, another exception occurred: invite_tg | invite_tg | Traceback (most recent call last): invite_tg | File "/code/bot/main.py", line 42, in <module> invite_tg | asyncio.get_event_loop().run_until_complete(init_db_connection()) invite_tg | File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete invite_tg | return future.result() invite_tg | File "/code/bot/database/core/init.py", line 19, in init_db_connection invite_tg | await Tortoise.init(TORTOISE_ORM)
invite_tg | File "/usr/local/lib/python3.9/site-packages/tortoise/__init__.py", line 598, in init invite_tg | await cls._init_connections(connections_config, _create_db) invite_tg | File "/usr/local/lib/python3.9/site-packages/tortoise/__init__.py", line 390, in _init_connections invite_tg | await connection.create_connection(with_db=True) invite_tg | File "/usr/local/lib/python3.9/site-packages/tortoise/backends/asyncpg/client.py", line 106, in create_connection invite_tg | raise DBConnectionError(f"Can't establish connection to database {self.database}") invite_tg | tortoise.exceptions.DBConnectionError: Can't establish connection to database invitebot
Обсуждают сегодня