uploader-bot/app/main.py

57 lines
2.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
MY Network - Main Application Entry Point
FastAPI приложение с поддержкой MY Network
"""
import asyncio
import logging
# Настройка логирования
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
async def main():
"""Главная функция запуска FastAPI сервера."""
print("""
╔══════════════════════════════════════════════════════════════════════════════╗
║ MY NETWORK v3.0 ║
║ Distributed Content Protocol ║
║ ║
║ Starting FastAPI application with MY Network integration... ║
╚══════════════════════════════════════════════════════════════════════════════╝
""")
try:
# Импортируем и запускаем полное FastAPI приложение
from app.fastapi_main import run_server
logger.info("Starting FastAPI server with MY Network...")
run_server()
except KeyboardInterrupt:
logger.info("Received keyboard interrupt, shutting down...")
except Exception as e:
logger.error(f"Application error: {e}")
raise
# FastAPI app для ASGI серверов (uvicorn, gunicorn)
try:
# Импортируем готовое FastAPI приложение
from app.fastapi_main import app
logger.info("FastAPI application imported successfully")
except Exception as e:
logger.error(f"Could not import FastAPI app: {e}")
app = None
if __name__ == "__main__":
# Запуск через python app/main.py
asyncio.run(main())