#!/usr/bin/env python3
from flask import Flask, send_from_directory
import os

app = Flask(__name__)
directory = os.getcwd()  # serve current directory

@app.route("/", defaults={"path": "index.html"})
@app.route("/<path:path>")
def serve_file(path):
    # If file exists, serve it
    if os.path.isfile(os.path.join(directory, path)):
        return send_from_directory(directory, path)
    else:
        return f"File not found: {path}", 404

if __name__ == "__main__":
    # debug=True enables auto-reload when this file changes
    app.run(host="0.0.0.0", port=8000, debug=True)

