From 366f496ba3c5b3ff0a3e8fbc3bcd2200054ea4b8 Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Fri, 6 Oct 2023 18:39:55 +0200 Subject: [PATCH] Enable external debugger --- src/main.py | 3 ++- src/solo_turnier/cli.py | 2 ++ src/solo_turnier/flask.py | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main.py b/src/main.py index be449ad..fcff5d8 100644 --- a/src/main.py +++ b/src/main.py @@ -24,7 +24,8 @@ def main(): batchWorker, debug=cli.getLogLevel() > 0, port=cli.getPort(), - showOnlyFinalists=not cli.showAllParticipants() + showOnlyFinalists=not cli.showAllParticipants(), + externalDebugger=cli.externalDebugger ) else: combinedData = batchWorker.run( diff --git a/src/solo_turnier/cli.py b/src/solo_turnier/cli.py index 12d6ee3..b190663 100644 --- a/src/solo_turnier/cli.py +++ b/src/solo_turnier/cli.py @@ -22,6 +22,8 @@ class Cli: debugpy.listen(5678) debugpy.wait_for_client() + self.externalDebugger = self.__args.debug + map = { 0: logging.ERROR, 1: logging.WARN, diff --git a/src/solo_turnier/flask.py b/src/solo_turnier/flask.py index 9c64bd1..ab5723c 100644 --- a/src/solo_turnier/flask.py +++ b/src/solo_turnier/flask.py @@ -8,7 +8,8 @@ def startFlask( batchWorker: solo_turnier.batch.BatchWorker, debug: bool = False, port: int = 8082, - showOnlyFinalists: bool = True + showOnlyFinalists: bool = True, + externalDebugger: bool = False, ): app = flask.Flask(__name__) @@ -27,4 +28,5 @@ def startFlask( ) return flask.Response(ret, mimetype='text/css') - app.run(host='0.0.0.0', port=port, debug=debug) + useReloader = debug and not externalDebugger + app.run(host='0.0.0.0', port=port, debug=debug, use_reloader=useReloader)