steve0greatness,
created on Tuesday, 5 March 2024, 05:36:53 (1709617013),
received on Monday, 6 May 2024, 02:55:38 (1714964138)
Author identity: Steve0Greatness <steve0greatnessiscool@gmail.com>
050ffb0e2eaf6d770dc06a731026bfc6235a9597
local-server.py
@@ -1,20 +0,0 @@
# This is a Flask server to emulate GitHub pages.
from flask import Flask, send_file as SendFile
from os.path import isfile
from pathlib import Path
FlaskOpts = {}
app = Flask(__name__, **FlaskOpts)
@app.route("/", defaults={"path": ""})
@app.route("/<path:path>")
def SendStatic(path):
if isfile("build/" + path):
return SendFile(Path("build").joinpath(path))
elif isfile(Path("build").joinpath(path, "index.html")):
return SendFile(Path("build").joinpath(path, "index.html"))
return SendFile("build/404.html")
if __name__ == "__main__":
app.run("0.0.0.0", 8000)