feat: app argument
This commit is contained in:
parent
55bd3332ca
commit
bc1781e7b5
11
app.py
11
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/<m>")
|
||||
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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user