@Erbosha

Как исправить ошибку при загрузке данных?

Использую бота https://github.com/soldatov-ss/flibusta-telegram-bot
Делаю всё через virtualenv
Для базы данных указываю всё правильно.
Вот мой .env
ADMINS=
BOT_TOKEN=
IP=

CITE_PASS=
CITE_LOGIN=
FORM_BUILD_ID=

DB_USER=
DB_PASS=
DB_HOST=
DB_NAME=

GROUP_ID=


но при запуске docker-compose up -d
получаю ошибку
Attaching to database, bot
database | Initializing datadir...
database | Initializing certdir...
database | Initializing logdir...
database | Initializing rundir...
database | Setting resolv.conf ACLs...
database | Initializing database...
database | Configuring hot standby...
database | ‣ Setting postgresql.conf parameter: wal_level = 'hot_standby'
database | ‣ Setting postgresql.conf parameter: max_wal_senders = '16'
database | ‣ Setting postgresql.conf parameter: checkpoint_segments = '8'
database | ‣ Setting postgresql.conf parameter: wal_keep_segments = '32'
database | ‣ Setting postgresql.conf parameter: hot_standby = 'on'
database | ‣ Setting postgresql.conf parameter: data_directory = '/var/lib/postgresql/10/main'
database | ‣ Setting postgresql.conf parameter: log_directory = '/var/log/postgresql'
database | ‣ Setting postgresql.conf parameter: log_filename = 'postgresql-10-main.log'
database | ‣ Setting postgresql.conf parameter: ssl = 'off'
database | Creating database user: tg
database | Creating database: bot...
database | ‣ Granting access to tg user...
database | Starting PostgreSQL 10...
database | 2022-05-12 01:49:47.810 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
database | 2022-05-12 01:49:47.811 UTC [1] LOG:  listening on IPv6 address "::", port 5432
database | 2022-05-12 01:49:47.813 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
database | 2022-05-12 01:49:47.827 UTC [199] LOG:  database system was shut down at 2022-05-12 01:49:47 UTC
database | 2022-05-12 01:49:47.831 UTC [1] LOG:  database system is ready to accept connections
bot      | Error occurred during loading data. Trying to use cache server https://fake-useragent.herokuapp.com/browsers/0.1.11
bot      | Traceback (most recent call last):
bot      |   File "/usr/local/lib/python3.10/site-packages/fake_useragent/utils.py", line 154, in load
bot      |     for item in get_browsers(verify_ssl=verify_ssl):
bot      |   File "/usr/local/lib/python3.10/site-packages/fake_useragent/utils.py", line 99, in get_browsers
bot      |     html = html.split('<table class="w3-table-all notranslate">')[1]
bot      | IndexError: list index out of range
bot      | Goodbye!
bot      | Traceback (most recent call last):
bot      |   File "/src/app.py", line 24, in <module>
bot      |     executor.start_polling(dp, on_startup=on_startup)
bot      |   File "/usr/local/lib/python3.10/site-packages/aiogram/utils/executor.py", line 45, in start_polling
bot      |     executor.start_polling(
bot      |   File "/usr/local/lib/python3.10/site-packages/aiogram/utils/executor.py", line 320, in start_polling
bot      |     loop.run_until_complete(self._startup_polling())
bot      |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
bot      |     return future.result()
bot      |   File "/usr/local/lib/python3.10/site-packages/aiogram/utils/executor.py", line 376, in _startup_polling
bot      |     await callback(self.dispatcher)
bot      |   File "/src/app.py", line 16, in on_startup
bot      |     await db.create()
bot      |   File "/src/utils/database/db_commands.py", line 15, in create
bot      |     self.pool = await asyncpg.create_pool(
bot      |   File "/usr/local/lib/python3.10/site-packages/asyncpg/pool.py", line 407, in _async__init__
bot      |     await self._initialize()
bot      |   File "/usr/local/lib/python3.10/site-packages/asyncpg/pool.py", line 435, in _initialize
bot      |     await first_ch.connect()
bot      |   File "/usr/local/lib/python3.10/site-packages/asyncpg/pool.py", line 127, in connect
bot      |     self._con = await self._pool._get_new_connection()
bot      |   File "/usr/local/lib/python3.10/site-packages/asyncpg/pool.py", line 477, in _get_new_connection
bot      |     con = await connection.connect(
bot      |   File "/usr/local/lib/python3.10/site-packages/asyncpg/connection.py", line 2045, in connect
bot      |     return await connect_utils._connect(
bot      |   File "/usr/local/lib/python3.10/site-packages/asyncpg/connect_utils.py", line 790, in _connect
bot      |     raise last_error
bot      |   File "/usr/local/lib/python3.10/site-packages/asyncpg/connect_utils.py", line 776, in _connect
bot      |     return await _connect_addr(
bot      |   File "/usr/local/lib/python3.10/site-packages/asyncpg/connect_utils.py", line 676, in _connect_addr
bot      |     return await __connect_addr(params, timeout, True, *args)
bot      |   File "/usr/local/lib/python3.10/site-packages/asyncpg/connect_utils.py", line 720, in __connect_addr
bot      |     tr, pr = await compat.wait_for(connector, timeout=timeout)
bot      |   File "/usr/local/lib/python3.10/site-packages/asyncpg/compat.py", line 66, in wait_for
bot      |     return await asyncio.wait_for(fut, timeout)
bot      |   File "/usr/local/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
bot      |     return fut.result()
bot      |   File "/usr/local/lib/python3.10/site-packages/asyncpg/connect_utils.py", line 586, in _create_ssl_connection
bot      |     tr, pr = await loop.create_connection(
bot      |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1072, in create_connection
bot      |     raise OSError('Multiple exceptions: {}'.format(
bot      | OSError: Multiple exceptions: [Errno 111] Connect call failed ('127.0.0.1', 5432), [Errno 99] Cannot assign requested address
bot      | Goodbye!


помогите пожалуйста разобраться
  • Вопрос задан
  • 1753 просмотра
Решения вопроса 1
iggor-markin
@iggor-markin
Python Developer
Этот бот запускается через docker-compose. Внутри файла есть дополнительная инструкция. Её нужно прочитать. Когда всё сделаешь, запустятся контейнеры с PostgreSQL и ботом. Между ними будет настроена сеть и они смогут друг с другом общаться.

Видимо, ты запускаешь всё на Heroku. Найди толковую инструкцию и загляни в документацию. Посмотри, какие есть особенности запуска docker-проектов.

Плюс есть и ответы по теме.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы