From b477737bad9f3355e4cf02349c5e3d5e5401b58d Mon Sep 17 00:00:00 2001 From: Ignace Date: Sun, 9 Aug 2026 17:07:38 +0200 Subject: [PATCH] gunicorn issue --- README.md | 2 +- app.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 823aa66..c9500cc 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ WorkingDirectory=/srv/fasthue Environment=FASTHUE_SECRETS_FILE=/etc/fasthue/secrets.yaml RuntimeDirectory=fasthue RuntimeDirectoryMode=0750 -ExecStart=/srv/fasthue/.venv/bin/gunicorn --workers 1 --umask 007 --bind unix:/run/fasthue/fasthue.sock --factory app:create_gunicorn_app +ExecStart=/srv/fasthue/.venv/bin/gunicorn --workers 1 --umask 007 --bind unix:/run/fasthue/fasthue.sock app:gunicorn_app Restart=on-failure RestartSec=3 diff --git a/app.py b/app.py index 936f397..eefbc69 100644 --- a/app.py +++ b/app.py @@ -234,6 +234,12 @@ def create_gunicorn_app() -> Flask: return create_app(config_path, verify_tls, api_key, configured_url_prefix()) +# Older Gunicorn releases do not support --factory. Expose a WSGI callable at +# import time so they can load this application with `app:gunicorn_app`. +if __name__ != "__main__": + gunicorn_app = create_gunicorn_app() + + def main() -> None: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--config", type=Path, default=ROOT / "hue.yaml", help="Dashboard YAML file")