mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
#1424:gunicorn can't run in windows
This commit is contained in:
parent
cbdb8d68a3
commit
574d042655
1 changed files with 35 additions and 29 deletions
|
@ -343,6 +343,9 @@ def run_server(
|
|||
)
|
||||
try:
|
||||
import uvicorn
|
||||
if os.name == "nt":
|
||||
pass
|
||||
else:
|
||||
import gunicorn.app.base
|
||||
except:
|
||||
raise ImportError(
|
||||
|
@ -427,6 +430,11 @@ def run_server(
|
|||
f"\033[1;34mSee all Router/Swagger docs on http://0.0.0.0:{port} \033[0m\n"
|
||||
) # noqa
|
||||
|
||||
from litellm.proxy.proxy_server import app
|
||||
if os.name == "nt":
|
||||
uvicorn.run(app, host=host, port=port) # run uvicorn
|
||||
else:
|
||||
import gunicorn.app.base
|
||||
# Gunicorn Application Class
|
||||
class StandaloneApplication(gunicorn.app.base.BaseApplication):
|
||||
def __init__(self, app, options=None):
|
||||
|
@ -454,8 +462,6 @@ def run_server(
|
|||
"worker_class": "uvicorn.workers.UvicornWorker",
|
||||
"preload": True, # Add the preload flag
|
||||
}
|
||||
from litellm.proxy.proxy_server import app
|
||||
|
||||
StandaloneApplication(app=app, options=gunicorn_options).run() # Run gunicorn
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue