Implemented static folder

This commit is contained in:
2026-06-02 16:07:27 +01:00
parent 1f69f7921a
commit 4f6bd4dae2
4 changed files with 31 additions and 1 deletions

16
app.py
View File

@ -4,11 +4,25 @@ A simple Flask application for interacting with WHSPAH shockers.
import argparse
import logging
import os
import waitress.server
import flask
app = flask.Flask(__name__)
app = flask.Flask(__name__, static_folder='./www/')
@app.route('/', defaults={'path': 'index.html'})
@app.route('/<path:path>')
def staticPage(path):
"""
Returns anything requested in the static folder.
"""
if os.path.isfile(os.path.join(app.static_folder, path, 'index.html')):
path = os.path.join(path, 'index.html')
return flask.send_from_directory(app.static_folder, path)
if __name__ == '__main__':
parser = argparse.ArgumentParser()