From bc1781e7b5da7bf7a48926085893cf9d12364a79 Mon Sep 17 00:00:00 2001 From: monoid Date: Wed, 25 May 2022 03:43:18 +0900 Subject: [PATCH] feat: app argument --- app.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 123b736..fd95a7e 100644 --- a/app.py +++ b/app.py @@ -1,9 +1,13 @@ -from distutils.log import debug 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/") def distServe(m:str): return flask.send_from_directory("dist", m) @@ -15,5 +19,6 @@ def index(): 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)