Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 682
kennysong Avatar asked Aug 21 '12 21:08

kennysong


People also ask

What is Gunicorn config?

Gunicorn reads configuration information from five places. Gunicorn first reads environment variables for some configuration settings. Gunicorn then reads configuration from a framework specific configuration file. Currently this only affects Paster applications.

Where are Gunicorn log files?

This log file is located at /var/log/cloudify/rest/gunicorn-access.

How do I check my Gunicorn process?

To see the processes is ps ax|grep gunicorn and to stop gunicorn_django is pkill gunicorn .


2 Answers

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 = '0.0.0.0:' + 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.

like image 132
Arnaud Joly Avatar answered Sep 30 '22 20:09

Arnaud Joly


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 
like image 33
iamyojimbo Avatar answered Sep 30 '22 20:09

iamyojimbo