This commit is contained in:
@@ -9,6 +9,10 @@ import os
|
|||||||
# this is the Alembic Config object, which provides
|
# this is the Alembic Config object, which provides
|
||||||
# access to the values within the .ini file in use.
|
# access to the values within the .ini file in use.
|
||||||
config = context.config
|
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.
|
# Interpret the config file for Python logging.
|
||||||
# This line sets up loggers basically.
|
# This line sets up loggers basically.
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
volumes:
|
volumes:
|
||||||
- ./bot.db:/app/bot.db
|
- ./db:/app/db
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
2
main.py
2
main.py
@@ -80,7 +80,7 @@ def main():
|
|||||||
if not TELEGRAM_TOKEN:
|
if not TELEGRAM_TOKEN:
|
||||||
print("Ошибка: TELEGRAM_TOKEN не найден в переменных окружения.")
|
print("Ошибка: TELEGRAM_TOKEN не найден в переменных окружения.")
|
||||||
return
|
return
|
||||||
sync_to_async(init_db())
|
# sync_to_async(init_db())
|
||||||
application = Application.builder().token(TELEGRAM_TOKEN).build()
|
application = Application.builder().token(TELEGRAM_TOKEN).build()
|
||||||
application.add_handler(CommandHandler('start', start))
|
application.add_handler(CommandHandler('start', start))
|
||||||
application.add_handler(CommandHandler('help', help_command))
|
application.add_handler(CommandHandler('help', help_command))
|
||||||
|
|||||||
Reference in New Issue
Block a user