From 024c245ba7978e615a01fea81c416e795f351899 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 13 Feb 2024 09:49:39 +0100 Subject: [PATCH] Run the server using PYTHONPATH and correct module (#17820) Executing the command from the README file should allow the user to run the application. Without the proposed changes either the error message `Error loading ASGI app. Could not import module "main".` or `ModuleNotFoundError: No module named 'openapi_server'` is being returned. --- .../src/main/resources/python-fastapi/README.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/python-fastapi/README.mustache b/modules/openapi-generator/src/main/resources/python-fastapi/README.mustache index 8e6e65b7e8b..06776ba79bd 100644 --- a/modules/openapi-generator/src/main/resources/python-fastapi/README.mustache +++ b/modules/openapi-generator/src/main/resources/python-fastapi/README.mustache @@ -18,7 +18,7 @@ To run the server, please execute the following from the root directory: ```bash pip3 install -r requirements.txt -uvicorn main:app --host 0.0.0.0 --port {{serverPort}} +PYTHONPATH=src uvicorn openapi_server.main:app --host 0.0.0.0 --port {{serverPort}} ``` and open your browser at `http://localhost:{{serverPort}}/docs/` to see the docs.