Stock/app.py

26 lines
687 B
Python
Raw Normal View History

2022-05-25 03:16:39 +09:00
import flask
2022-05-25 03:43:18 +09:00
import argparse
2022-05-25 03:16:39 +09:00
2022-05-25 03:43:18 +09:00
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")
2022-05-25 03:16:39 +09:00
2022-05-25 03:43:18 +09:00
app = flask.Flask(__name__)
2022-05-25 03:31:45 +09:00
@app.route("/dist/<m>")
def distServe(m:str):
2022-05-25 03:16:39 +09:00
return flask.send_from_directory("dist", m)
2022-05-25 03:31:45 +09:00
@app.route("/")
def index():
import pages
return flask.render_template("index.html", pages = pages.GenLists)
2022-06-12 18:13:54 +09:00
2022-05-25 03:16:39 +09:00
if __name__ == '__main__':
2022-05-25 03:43:18 +09:00
args = parser.parse_args()
app.run(host=args.host, port=args.port, debug=args.debug)
2022-05-25 03:16:39 +09:00