Make port of web server configurable
This commit is contained in:
parent
da7a15fc0e
commit
5140244d13
@ -20,7 +20,11 @@ def main():
|
||||
if cli.showGUI():
|
||||
raise Exception('Not yet implemented')
|
||||
elif cli.startFlaskServer():
|
||||
solo_turnier.flask.startFlask(batchWorker, cli.getLogLevel() > 0)
|
||||
solo_turnier.flask.startFlask(
|
||||
batchWorker,
|
||||
debug=cli.getLogLevel() > 0,
|
||||
port=cli.getPort()
|
||||
)
|
||||
else:
|
||||
combinedData = batchWorker.run()
|
||||
|
||||
|
@ -8,6 +8,7 @@ class Cli:
|
||||
parser = argparse.ArgumentParser()
|
||||
# parser.add_argument('--gui', help='Show the GUI', action='store_true')
|
||||
parser.add_argument('--no-flask', action='store_false', dest='flask', help='Disable the internal flask web server')
|
||||
parser.add_argument('--port', help='The port to listen for incoming requests')
|
||||
|
||||
parser.add_argument('html', help='The path from where to look for HTML export files', nargs=1, default=['.'])
|
||||
parser.add_argument('-o', '--output', help='Set the output path of the script', nargs=1, default=[None])
|
||||
@ -52,3 +53,6 @@ class Cli:
|
||||
|
||||
def showAllParticipants(self):
|
||||
return self.__args.all_participants
|
||||
|
||||
def getPort(self):
|
||||
return int(self.__args.port)
|
||||
|
@ -1,7 +1,11 @@
|
||||
import flask
|
||||
import solo_turnier
|
||||
|
||||
def startFlask(batchWorker: solo_turnier.batch.BatchWorker, debug: bool = False):
|
||||
def startFlask(
|
||||
batchWorker: solo_turnier.batch.BatchWorker,
|
||||
debug: bool = False,
|
||||
port: int = 8082
|
||||
):
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
@ -10,4 +14,4 @@ def startFlask(batchWorker: solo_turnier.batch.BatchWorker, debug: bool = False)
|
||||
|
||||
return flask.render_template('index.html', data=combinedData)
|
||||
|
||||
app.run(host='0.0.0.0', port=8082, debug=debug)
|
||||
app.run(host='0.0.0.0', port=port, debug=debug)
|
||||
|
Loading…
Reference in New Issue
Block a user