From 3511b9805c002b1b7c57fd11b0a846874a1a42ff Mon Sep 17 00:00:00 2001 From: yangdx Date: Sat, 1 Mar 2025 15:34:01 +0800 Subject: [PATCH] Add auto-installation of gunicorn if not present in environment --- run_with_gunicorn.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/run_with_gunicorn.py b/run_with_gunicorn.py index 6aa2b0f3..decd91de 100755 --- a/run_with_gunicorn.py +++ b/run_with_gunicorn.py @@ -45,6 +45,12 @@ def main(): print(f"Workers setting: {args.workers}") print("=" * 80 + "\n") + # Check and install gunicorn if not present + import pipmaster as pm + if not pm.is_installed("gunicorn"): + print("Installing gunicorn...") + pm.install("gunicorn") + # Import Gunicorn's StandaloneApplication from gunicorn.app.base import BaseApplication