diff --git a/alembic/env.py b/alembic/env.py index d45cdf8..a1389e0 100644 --- a/alembic/env.py +++ b/alembic/env.py @@ -9,6 +9,10 @@ import os # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config +import os +db_url = os.getenv("DATABASE_URL", "sqlite+aiosqlite:///db/bot.db") +db_url_sync = db_url.replace("sqlite+aiosqlite", "sqlite") # Alembic нужен sync-драйвер +config.set_main_option("sqlalchemy.url", db_url_sync) # Interpret the config file for Python logging. # This line sets up loggers basically. diff --git a/docker-compose.yml b/docker-compose.yml index 082c0c5..85106a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,5 +4,5 @@ services: env_file: - .env volumes: - - ./bot.db:/app/bot.db + - ./db:/app/db restart: unless-stopped diff --git a/main.py b/main.py index c84a329..ff26b1d 100644 --- a/main.py +++ b/main.py @@ -80,7 +80,7 @@ def main(): if not TELEGRAM_TOKEN: print("Ошибка: TELEGRAM_TOKEN не найден в переменных окружения.") return - sync_to_async(init_db()) + # sync_to_async(init_db()) application = Application.builder().token(TELEGRAM_TOKEN).build() application.add_handler(CommandHandler('start', start)) application.add_handler(CommandHandler('help', help_command))