From f4a208a9b705ac178e8d19f7dc1f81202614a015 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Tue, 11 Jun 2024 10:45:28 +0000 Subject: [PATCH] Fix issue in server URL --- weatherman/app.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/weatherman/app.py b/weatherman/app.py index e0b7bec..438c24f 100644 --- a/weatherman/app.py +++ b/weatherman/app.py @@ -10,15 +10,14 @@ logging.basicConfig(level=logging.INFO) host = environ.get("DOMAIN", "localhost") -port = 9000 +port = 8000 protocol = "http" if host == "localhost" else "https" - -app = FastAPI( - servers=[ - {"url": f"{protocol}://{host}:{port}", "description": "Weather app server"} - ] +base_url = ( + f"{protocol}://{host}:{port}" if host == "localhost" else f"{protocol}://{host}" ) +app = FastAPI(servers=[{"url": base_url, "description": "Weather app server"}]) + class HourlyForecast(BaseModel): forecast_time: datetime.time