Implemented static folder
This commit is contained in:
16
app.py
16
app.py
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user