diff --git a/src/server/app.py b/src/server/app.py index 69c00de..d8f2e67 100644 --- a/src/server/app.py +++ b/src/server/app.py @@ -5,9 +5,6 @@ import os app = Flask(__name__) CORS(app) # Enable CORS for all routes -# Get the directory where this script is located -script_dir = os.path.dirname(os.path.abspath(__file__)) - # Import our archive parser from parse_archive import ArchiveParser @@ -16,18 +13,20 @@ archive_parser = ArchiveParser() # Serve static files from the website directory +# The website directory is at the same level as the src directory @app.route("/") def serve_static(filename): - # Use absolute path to website directory - website_dir = os.path.join(script_dir, "..", "website") + # In Docker, the structure is: /app/src/server/ and /app/website/ + # So we need to go up from src/server to /app/ and then to /app/website + website_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "website") return send_from_directory(website_dir, filename) # Serve the main index.html page @app.route("/") def serve_index(): - # Use absolute path to website directory - website_dir = os.path.join(script_dir, "..", "website") + # In Docker, the structure is: /app/src/server/ and /app/website/ + website_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "website") return send_from_directory(website_dir, "index.html")