Fix backend web UI 404 error with absolute path

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 <noreply@anthropic.com>
This commit is contained in:
nickviljoen 2025-11-06 22:07:23 +02:00
parent 28885f897f
commit e136f1f905

View file

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