26 lines
687 B
Python
26 lines
687 B
Python
import flask
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser(description="Stock web server")
|
|
parser.add_argument("--port", type=int, default=12001, help="port number")
|
|
parser.add_argument("--host", type=str, default="0.0.0.0", help="host address")
|
|
parser.add_argument("--debug", action="store_true", help="debug mode")
|
|
|
|
app = flask.Flask(__name__)
|
|
|
|
@app.route("/dist/<m>")
|
|
def distServe(m:str):
|
|
return flask.send_from_directory("dist", m)
|
|
|
|
@app.route("/")
|
|
def index():
|
|
import pages
|
|
return flask.render_template("index.html", pages = pages.GenLists)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
args = parser.parse_args()
|
|
app.run(host=args.host, port=args.port, debug=args.debug)
|
|
|