Skip to content

Commit

Permalink
Одноконтейнерный синхронный запуск FastAPI и бота
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazarini8 committed Nov 18, 2024
1 parent 184ad63 commit a25918d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import multiprocessing
import uvicorn

import uvicorn
from telegram import Update

from app.main import app # Импорт FastAPI-приложения

from bot.services import init_bot


Expand All @@ -15,7 +16,7 @@ def run_bot() -> None:

def run_fastapi() -> None:
"""Запуск FastAPI."""
uvicorn.run(app, host="0.0.0.0", port=8000)
uvicorn.run(app, host='0.0.0.0', port=8000)


def run_both() -> None:
Expand All @@ -32,5 +33,5 @@ def run_both() -> None:
fastapi_process.join()


if __name__ == "__main__":
if __name__ == '__main__':
run_both()

0 comments on commit a25918d

Please sign in to comment.