X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/300921a93e29d6bdc2a7da8ceaebfcce0c555c84..2af20f8df88461f2593c7fa0851e3841f20d66c3:/nominatim/server/falcon/server.py?ds=inline diff --git a/nominatim/server/falcon/server.py b/nominatim/server/falcon/server.py index 18853307..c11cf4a8 100644 --- a/nominatim/server/falcon/server.py +++ b/nominatim/server/falcon/server.py @@ -10,7 +10,6 @@ Server implementation using the falcon webserver framework. from typing import Optional, Mapping, cast, Any from pathlib import Path -import falcon from falcon.asgi import App, Request, Response from nominatim.api import NominatimAPIAsync @@ -26,9 +25,12 @@ class HTTPNominatimError(Exception): self.content_type = content_type -async def nominatim_error_handler(req: Request, resp: Response, +async def nominatim_error_handler(req: Request, resp: Response, #pylint: disable=unused-argument exception: HTTPNominatimError, _: Any) -> None: + """ Special error handler that passes message and content type as + per exception info. + """ resp.status = exception.status resp.text = exception.msg resp.content_type = exception.content_type @@ -99,3 +101,11 @@ def get_application(project_dir: Path, app.add_route(f"/{name}.php", endpoint) return app + + +def run_wsgi() -> App: + """ Entry point for uvicorn. + + Make sure uvicorn is run from the project directory. + """ + return get_application(Path('.'))