Open maringuu opened 6 months ago
In general, it is possible to start the app directly with your WSGI framework of choice but the app expects an argument containing the path to the parsed CLI args. If you provide it, it works e.g.
gunicorn flask_app_wrapper:app /tmp/pickle
If we change the way the CLI arguments are handled in the app, we could easily get it to work without args (e.g. pass the config through Redis or just load a default).
this minimal patch seems to be enough for just being able to start the app with default config:
diff --git a/src/flask_app_wrapper.py b/src/flask_app_wrapper.py
index 434c801e..a710e7a7 100644
--- a/src/flask_app_wrapper.py
+++ b/src/flask_app_wrapper.py
@@ -32,7 +32,9 @@ def create_web_interface():
if args_path.is_file():
args = pickle.loads(args_path.read_bytes())
config_file = getattr(args, 'config_file', None)
- config.load(config_file)
+ else:
+ config_file = Path(__file__).parent / 'config' / 'fact-core-config.toml'
+ config.load(config_file)
setup_logging(args, 'frontend')
return WebFrontEnd()
Currently the FACT frontend ist started via
./start_fact_frontend
. This script starts some docker containers,uwsgi
, and most importantly has some initialisation logic. This is not the right approach to expose a wsgi app. In short, it should be possible to runflask --app src/flask_app_wrapper.py run
. Currently this errors out with the following:Error
``` Traceback (most recent call last): File "/root/venvs/fact-v4.1.1/bin/flask", line 8, inNot being able to run the flask debug server has significantly decreased my productivity when working on the frontend. Besides the argument that the current implementation is unusual and too complicated, the debug server is the main motivation for this issue. Another motivation is to not depend on uwsgi but rather let the user decide which wsgi server they want to use.
I think two things have to be done: