pyservectl init

This commit is contained in:
Илья Глазунов
2025-12-04 02:55:14 +03:00
parent b4f63c6804
commit 80544d5b95
21 changed files with 3391 additions and 14 deletions
+8 -5
View File
@@ -11,22 +11,25 @@ The WSGI app path is passed via environment variables:
import importlib
import os
from typing import Any, Callable, Optional
from typing import Any, Callable, Optional, Type
WSGIMiddlewareType = Optional[Type[Any]]
WSGI_ADAPTER: Optional[str] = None
WSGIMiddleware: WSGIMiddlewareType = None
try:
from a2wsgi import WSGIMiddleware
from a2wsgi import WSGIMiddleware as _A2WSGIMiddleware
WSGIMiddleware = _A2WSGIMiddleware
WSGI_ADAPTER = "a2wsgi"
except ImportError:
try:
from asgiref.wsgi import WsgiToAsgi as WSGIMiddleware # type: ignore
from asgiref.wsgi import WsgiToAsgi as _AsgirefMiddleware
WSGIMiddleware = _AsgirefMiddleware
WSGI_ADAPTER = "asgiref"
except ImportError:
WSGIMiddleware = None # type: ignore
WSGI_ADAPTER = None
pass
def _load_wsgi_app() -> Callable[..., Any]: