Changes between Version 12 and Version 13 of Gunicorn
- Timestamp:
- Jan 19, 2016, 2:50:52 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Gunicorn
v12 v13 3 3 [http://gunicorn.org/ Gunicorn] (Green Unicorn) is a Python WSGI HTTP Server for UNIX. It is a pre-fork worker model ported from Ruby's Unicorn project. The Gunicorn server is broadly compatible with various web frameworks, simply implemented, light on server resources, and fairly speedy. 4 4 5 1. Install gunicorn 5 '''1. Install Gunicorn''' 6 6 7 Gunicorn is a Python project which lives on pypi, so we can use easy_install or pip to install Gunicorn:7 Gunicorn is a Python project which can be found on [pypi:gunicorn PyPi], so we can use `easy_install` or `pip` to install: 8 8 {{{#!sh 9 9 $> pip install gunicorn … … 12 12 I prefer to use a [pypi:virtualenv], to not have to install Gunicorn in a system wide fashion. 13 13 14 2. Write your wsgi file 14 '''2. Write your wsgi file''' 15 15 16 Gunicorn is [ http://en.wikipedia.org/wiki/Web_Server_Gateway_Interface WSGI compliant], so we need a simplePython script `tracwsgi.py` that functions as an entry point:16 Gunicorn is [wikipedia:Web_Server_Gateway_Interface WSGI compliant], so we need a Python script `tracwsgi.py` that functions as an entry point: 17 17 18 18 {{{#!python … … 22 22 sys.stdout = sys.stderr 23 23 24 # put here your ENV's Variables24 # put here your ENV variables 25 25 # here is an example with multiple instances 26 26 os.environ['TRAC_ENV_PARENT_DIR'] = '/home/repos/trac/' … … 29 29 import trac.web.main 30 30 application = trac.web.main.dispatch_request 31 32 31 }}} 33 32 … … 45 44 How it works: Gunicorn is looking for a method called "application" in the tracwsgi.py file. 46 45 47 3. Configure Nginx 46 '''3. Configure Nginx''' 48 47 49 48 Now we will make it work with Nginx, which will redirect Trac requests to Gunicorn: