From e717e349d0aef7ea396f49a64841e268697b165a Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Tue, 28 Mar 2023 15:03:00 +0200 Subject: [PATCH] add wsgi entry point for starlette uvicorn needs a parameter-free function to start. --- nominatim/server/starlette/server.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nominatim/server/starlette/server.py b/nominatim/server/starlette/server.py index be7d95d1..a2a70ebf 100644 --- a/nominatim/server/starlette/server.py +++ b/nominatim/server/starlette/server.py @@ -60,7 +60,8 @@ def _wrap_endpoint(func: api_impl.EndpointFunc)\ def get_application(project_dir: Path, - environ: Optional[Mapping[str, str]] = None) -> Starlette: + environ: Optional[Mapping[str, str]] = None, + debug: bool = True) -> Starlette: """ Create a Nominatim falcon ASGI application. """ config = Configuration(project_dir, environ) @@ -77,8 +78,14 @@ def get_application(project_dir: Path, if config.get_bool('CORS_NOACCESSCONTROL'): middleware.append(Middleware(CORSMiddleware, allow_origins=['*'])) - app = Starlette(debug=True, routes=routes, middleware=middleware) + app = Starlette(debug=debug, routes=routes, middleware=middleware) app.state.API = NominatimAPIAsync(project_dir, environ) return app + + +def run_wsgi() -> Starlette: + """ Entry point for uvicorn. + """ + return get_application(Path('.'), debug=False) -- 2.39.5