mirror of
https://github.com/johndoe6345789/AutoMetabuilder.git
synced 2026-04-24 13:54:59 +00:00
Address code review feedback - fix hard-coded paths and bare except
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -153,17 +153,20 @@ def create_app():
|
||||
app.register_blueprint(navigation_bp)
|
||||
|
||||
# Serve static files
|
||||
from pathlib import Path
|
||||
frontend_dist = Path(__file__).resolve().parent.parent.parent.parent / 'frontend' / 'dist'
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return send_from_directory('/home/runner/work/AutoMetabuilder/AutoMetabuilder/frontend/dist', 'index.html')
|
||||
return send_from_directory(frontend_dist, 'index.html')
|
||||
|
||||
@app.route('/<path:path>')
|
||||
def serve_static(path):
|
||||
try:
|
||||
return send_from_directory('/home/runner/work/AutoMetabuilder/AutoMetabuilder/frontend/dist', path)
|
||||
except:
|
||||
return send_from_directory(frontend_dist, path)
|
||||
except (FileNotFoundError, OSError):
|
||||
# Fallback to index.html for SPA routing
|
||||
return send_from_directory('/home/runner/work/AutoMetabuilder/AutoMetabuilder/frontend/dist', 'index.html')
|
||||
return send_from_directory(frontend_dist, 'index.html')
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to register routes: {e}")
|
||||
|
||||
Reference in New Issue
Block a user