forked from aegis/pyserveX
pyservectl init
This commit is contained in:
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user