You can run Gunicorn by using commands or integrate with Django or Paster. For deploying Gunicorn in production see Deploying Gunicorn.
After installing Gunicorn you will have access to the command line script gunicorn.
$ gunicorn [OPTIONS] APP_MODULE
Where APP_MODULE is of the pattern $(MODULE_NAME):$(VARIABLE_NAME). The module name can be a full dotted path. The variable name refers to a WSGI callable that should be found in the specified module.
Example with test app:
$ cd examples $ cat test.py # -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. def app(environ, start_response): """Simplest possible application object""" data = 'Hello, World!\n' status = '200 OK' response_headers = [ ('Content-type','text/plain'), ('Content-Length', str(len(data))) ] start_response(status, response_headers) return iter([data]) $ gunicorn --workers=2 test:app
We also provide integration for both Django and Paster applications.
gunicorn just needs to be called with a the location of a WSGI application object.:
gunicorn [OPTIONS] APP_MODULE
Where APP_MODULE is of the pattern MODULE_NAME:VARIABLE_NAME. The module name should be a full dotted path. The variable name refers to a WSGI callable that should be found in the specified module.
So for a typical Django project, invoking gunicorn would look like:
(This requires that your project be on the Python path; the simplest way to ensure that is to run this command from the same directory as your manage.py file.)
If you are a user/developer of a paste-compatible framework/app (as Pyramid, Pylons and Turbogears) you can use the gunicorn –paste option to run your application.
gunicorn –paste development.ini -b :8080 –chdir /path/to/project
Or use a different application:
gunicorn –paste development.ini#admin -b :8080 –chdir /path/to/project
It is all here. No configuration files nor additional python modules to write !!