From 3878b817815dfec3d0d5432e283e5f83f571804e Mon Sep 17 00:00:00 2001 From: leonard Date: Tue, 5 Mar 2024 16:04:22 +0100 Subject: [PATCH] fix de l'exemple d'application Fastapi pour qu'elle marche dans un sous domaine --- conf/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conf/__init__.py b/conf/__init__.py index 5703e85..855b69c 100644 --- a/conf/__init__.py +++ b/conf/__init__.py @@ -5,8 +5,10 @@ from fastapi import FastAPI UVICORN_ROOT_PATH = os.environ.get('UVICORN_ROOT_PATH') -#app = FastAPI(root_path=UVICORN_ROOT_PATH) -app = FastAPI() +if UVICORN_ROOT_PATH and len(UVICORN_ROOT_PATH) > 0 and UVICORN_ROOT_PATH != '/': + app = FastAPI(root_path=UVICORN_ROOT_PATH) +else: + app = FastAPI() @app.get("/") def read_root():