From b7ec5d03e6c1c8c525be90924c483d6a56fe8fd1 Mon Sep 17 00:00:00 2001 From: Deion Fellers Date: Mon, 7 Jul 2025 15:44:36 -0700 Subject: [PATCH] separate command line arguments for gunicorn and flask app --- viewer/functions/commandline.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/viewer/functions/commandline.py b/viewer/functions/commandline.py index f426ea359..8276b3acf 100755 --- a/viewer/functions/commandline.py +++ b/viewer/functions/commandline.py @@ -3,6 +3,7 @@ from __future__ import annotations import argparse # Pass command line arguments into python script import multiprocessing import os +import sys import yaml # Read YAML config file @@ -89,7 +90,14 @@ def getArgs(): action="store_true", ) - args = parser.parse_args() + # If running with gunicorn, we need to separate the arguments. + # Where the gunicorn arguments and the app arguments are seperated by a standalone -- + if '--' in sys.argv: + separator_index = sys.argv.index('--') + sys_args = sys.argv[separator_index+1:] # get app arguments, which are after the separator + else: + sys_args = sys.argv # assume all arguments are app arguments + args = parser.parse_args(sys_args) # Overwrite arguments from config file if args.config is not None: -- GitLab