Fix file path handling in Flask app for Docker deployment
This commit is contained in:
parent
271fddc26e
commit
70c0106181
@ -18,13 +18,17 @@ archive_parser = ArchiveParser()
|
||||
# Serve static files from the website directory
|
||||
@app.route("/<path:filename>")
|
||||
def serve_static(filename):
|
||||
return send_from_directory("../website", filename)
|
||||
# Use absolute path to website directory
|
||||
website_dir = os.path.join(script_dir, "..", "website")
|
||||
return send_from_directory(website_dir, filename)
|
||||
|
||||
|
||||
# Serve the main index.html page
|
||||
@app.route("/")
|
||||
def serve_index():
|
||||
return send_from_directory("../website", "index.html")
|
||||
# Use absolute path to website directory
|
||||
website_dir = os.path.join(script_dir, "..", "website")
|
||||
return send_from_directory(website_dir, "index.html")
|
||||
|
||||
|
||||
@app.route("/posts", methods=["GET"])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user