feat: app argument

This commit is contained in:
monoid 2022-05-25 03:43:18 +09:00
parent 55bd3332ca
commit bc1781e7b5

11
app.py
View File

@ -1,9 +1,13 @@
from distutils.log import debug
import flask 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 = flask.Flask(__name__)
@app.route("/dist/<m>") @app.route("/dist/<m>")
def distServe(m:str): def distServe(m:str):
return flask.send_from_directory("dist", m) return flask.send_from_directory("dist", m)
@ -15,5 +19,6 @@ def index():
if __name__ == '__main__': if __name__ == '__main__':
app.run(host='0.0.0.0', port=12001, debug=True) args = parser.parse_args()
app.run(host=args.host, port=args.port, debug=args.debug)