Where is the Gunicorn config file?


The gunicorn documentation talks about editing the config files, but I have no idea where it is.

Probably a simple answer :) I'm on Amazon Linux AMI.

8/21/2012 9:39:41 PM

Accepted Answer

The answer is in the documentation of gunicorn. http://docs.gunicorn.org/en/latest/configure.html

You can specify the config file with .ini or a python script.

For example, from the django-skel project

"""gunicorn WSGI server configuration."""
from multiprocessing import cpu_count
from os import environ

def max_workers():    
    return cpu_count()

bind = '' + environ.get('PORT', '8000')
max_requests = 1000
worker_class = 'gevent'
workers = max_workers()

And you can run the server using

gunicorn -c gunicorn.py.ini project.wsgi

Note that project.wsgi correspond to the location of your wsgi.

11/12/2012 9:08:48 AM

An example file is here: https://github.com/benoitc/gunicorn/blob/master/examples/example_config.py

You can just comment out what you don't need and then point Gunicorn at it like so:

gunicorn -c config.py myproject:app

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow