1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

Initial commit

This commit is contained in:
MoonTestUse1
2024-12-23 19:27:44 +06:00
commit e81df4c87e
4952 changed files with 1705479 additions and 0 deletions

34
backend/run.py Normal file
View File

@@ -0,0 +1,34 @@
import asyncio
import uvicorn
from app.main import app
from app.bot import start_bot
from logging import getLogger
logger = getLogger(__name__)
async def run_bot():
"""Run Telegram bot"""
try:
await start_bot()
except Exception as e:
logger.error(f"Bot crashed: {e}", exc_info=True)
async def run_api():
"""Run FastAPI application"""
config = uvicorn.Config(app, host="localhost", port=8080, reload=True)
server = uvicorn.Server(config)
try:
await server.serve()
except Exception as e:
logger.error(f"API crashed: {e}", exc_info=True)
async def run_all():
"""Run both bot and API"""
await asyncio.gather(run_bot(), run_api())
if __name__ == "__main__":
asyncio.run(run_all())