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.
This commit is contained in:
hy89 2025-02-17 19:33:49 +08:00 committed by GitHub
parent 42ee209084
commit 7b5d831296
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)