Kaizendae
Kaizendae

Reputation: 1053

How to specify uvicorn workers in gunicorn conf file

I run Django app with gunicorn using: 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

Now I run it with gunicorn + uvicorn gunicorn -c gunicorn.conf.py config.asgi -k uvicorn.workers.UvicornWorker

and I want the add the -k uvicorn.workers.UvicornWorker to the gunicorn.conf.py

Upvotes: 2

Views: 2280

Answers (2)

Kaizendae
Kaizendae

Reputation: 1053

I added worker_class = 'uvicorn.workers.UvicornWorker', Documeted 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'

Upvotes: 0

Iain Shelvington
Iain Shelvington

Reputation: 32244

According to the docs the setting is named worker_class, the following should work

worker_class = 'uvicorn.workers.UvicornWorker'

Upvotes: 5

Related Questions