如何在 gunicorn conf 文件中指定 uvicorn worker
How to specify uvicorn workers in gunicorn conf file
我 运行 带有 gunicorn 的 Django 应用程序使用:gunicorn -c gunicorn.conf.py config.wsgi
## gunicorn.conf.py:
from os import environ
bind = '0.0.0.0:' + environ.get('PORT', '8000')
workers = environ.get('WORKERS', 8)
loglevel = 'info'
graceful_timeout = 300
现在我运行用gunicorn + uvicorn gunicorn -c gunicorn.conf.py config.asgi -k uvicorn.workers.UvicornWorker
我想将 -k uvicorn.workers.UvicornWorker
添加到 gunicorn.conf.py
根据 docs 设置命名为 worker_class
,以下应该有效
worker_class = 'uvicorn.workers.UvicornWorker'
我添加了 worker_class = 'uvicorn.workers.UvicornWorker'
,记录了 here
from os import environ
bind = '0.0.0.0:' + environ.get('PORT', '8000')
workers = environ.get('WORKERS', 8)
loglevel = 'info'
graceful_timeout = 300
worker_class = 'uvicorn.workers.UvicornWorker'
我 运行 带有 gunicorn 的 Django 应用程序使用:gunicorn -c gunicorn.conf.py config.wsgi
## gunicorn.conf.py:
from os import environ
bind = '0.0.0.0:' + environ.get('PORT', '8000')
workers = environ.get('WORKERS', 8)
loglevel = 'info'
graceful_timeout = 300
现在我运行用gunicorn + uvicorn gunicorn -c gunicorn.conf.py config.asgi -k uvicorn.workers.UvicornWorker
我想将 -k uvicorn.workers.UvicornWorker
添加到 gunicorn.conf.py
根据 docs 设置命名为 worker_class
,以下应该有效
worker_class = 'uvicorn.workers.UvicornWorker'
我添加了 worker_class = 'uvicorn.workers.UvicornWorker'
,记录了 here
from os import environ
bind = '0.0.0.0:' + environ.get('PORT', '8000')
workers = environ.get('WORKERS', 8)
loglevel = 'info'
graceful_timeout = 300
worker_class = 'uvicorn.workers.UvicornWorker'