local_server.py
Python script, ASCII text executable
1from flask import Flask, send_file as SendFile 2from os.path import exists as PathExists, join as JoinPath, isfile 3from os import getcwd 4 5app = Flask(__name__) 6 7@app.route("/") 8def Index(): 9return SendFile("../index.html") 10 11@app.route("/<path:path>") 12def Other(path): 13FindFile = JoinPath(getcwd(), path).replace("\\", "/") 14if not isfile(FindFile): 15return SendFile(JoinPath(FindFile, "index.html").replace("\\", "/")) 16elif PathExists(FindFile): 17return SendFile(FindFile) 18return SendFile("../404.html"), 404 19 20if __name__ == "__main__": 21app.run("0.0.0.0", 9000, debug=True)