From 7b5d8312961874841b652512ac5495b2b46a017b Mon Sep 17 00:00:00 2001 From: hy89 <31279043+hy89@users.noreply.github.com> Date: Mon, 17 Feb 2025 19:33:49 +0800 Subject: [PATCH] Fix: Starting the source code on Windows, the 'HTTP API' returns 404 (#5042) Fix: When starting the backend service from source code on Windows, the "HTTP API" no longer returns 404. --- api/apps/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/apps/__init__.py b/api/apps/__init__.py index 42fc5d616..3c13be5b3 100644 --- a/api/apps/__init__.py +++ b/api/apps/__init__.py @@ -119,8 +119,9 @@ def register_page(page_path): sys.modules[module_name] = page spec.loader.exec_module(page) page_name = getattr(page, "page_name", page_name) + sdk_path = "\\sdk\\" if sys.platform.startswith("win") else "/sdk/" url_prefix = ( - f"/api/{API_VERSION}" if "/sdk/" in path else f"/{API_VERSION}/{page_name}" + f"/api/{API_VERSION}" if sdk_path in path else f"/{API_VERSION}/{page_name}" ) app.register_blueprint(page.manager, url_prefix=url_prefix)