From e136f1f90516dfe11ddfef73eb3d4f7530ad0337 Mon Sep 17 00:00:00 2001 From: nickviljoen Date: Thu, 6 Nov 2025 22:07:23 +0200 Subject: [PATCH] Fix backend web UI 404 error with absolute path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Applied the same web_ui.html path fix to backend/api_server.py that was previously applied to the root api_server.py. The backend version needs to reference the parent directory since web_ui.html is located at /opt/ai_qc/web_ui.html while api_server.py is in /opt/ai_qc/backend/. This fixes the 404 error when running via Waitress production server. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- backend/api_server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/api_server.py b/backend/api_server.py index b15f31a..2abfbf1 100755 --- a/backend/api_server.py +++ b/backend/api_server.py @@ -1303,7 +1303,10 @@ def load_qc_apps(): def serve_web_ui(): """Serve the web UI""" try: - with open('web_ui.html', 'r') as f: + # Use absolute path to web_ui.html (located in parent directory) + base_dir = os.path.dirname(os.path.abspath(__file__)) + web_ui_path = os.path.join(os.path.dirname(base_dir), 'web_ui.html') + with open(web_ui_path, 'r') as f: html_content = f.read() return Response(html_content, mimetype='text/html') except FileNotFoundError: