35 lines
852 B
Python
35 lines
852 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
MY Network API Server Entry Point
|
|
"""
|
|
|
|
import asyncio
|
|
import uvloop
|
|
from app.api import app, logger
|
|
from app.core.config import settings
|
|
|
|
def main():
|
|
"""Start MY Network API server"""
|
|
try:
|
|
# Use uvloop for better async performance
|
|
uvloop.install()
|
|
|
|
logger.info("Starting MY Network API Server...")
|
|
|
|
# Start server in single process mode to avoid worker conflicts
|
|
app.run(
|
|
host="0.0.0.0",
|
|
port=settings.SANIC_PORT,
|
|
debug=settings.DEBUG,
|
|
auto_reload=False,
|
|
single_process=True
|
|
)
|
|
|
|
except KeyboardInterrupt:
|
|
logger.info("Server stopped by user")
|
|
except Exception as e:
|
|
logger.error(f"Server startup failed: {e}")
|
|
raise
|
|
|
|
if __name__ == "__main__":
|
|
main() |