Changes between Version 10 and Version 11 of Gunicorn
- Timestamp:
- Feb 19, 2015, 8:44:18 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Gunicorn
v10 v11 5 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 lives on pypi, so we can use easy_install or pip to install Gunicorn: 8 8 {{{#!sh 9 9 $> pip install gunicorn 10 10 }}} 11 11 12 I prefer to use a [http://pypi.python.org/pypi/virtualenv virtualenv], to not have to install gunicorn in a system wide fashion.12 I prefer to use a [http://pypi.python.org/pypi/virtualenv virtualenv], to not have to install Gunicorn in a system wide fashion. 13 13 14 14 2. Write your wsgi file … … 43 43 44 44 In your web browser go to http://localhost:8000 and it should work. 45 How it works: gunicorn is looking for a method called "application" in the tracwsgi.py file.45 How it works: Gunicorn is looking for a method called "application" in the tracwsgi.py file. 46 46 47 47 3. Configure Nginx 48 48 49 So, now we have Gunicorn running, but we will make it work with Nginx which will redirect Trac requests to gunicorn:49 Now we will make it work with Nginx, which will redirect Trac requests to Gunicorn: 50 50 51 51 {{{#!nginx … … 77 77 }}} 78 78 79 '''Note''': Nginx will redirect requests to a UNIX socket. It can be a simple ip:port combination. It can be a multiple instance of gunicorn. Take a look in the [http://wiki.nginx.org/HttpUpstreamModule Nginx documentation].79 '''Note''': Nginx will redirect requests to a UNIX socket. This can either be a simple ip:port combination or multiple instances of Gunicorn. Take a look in the [http://wiki.nginx.org/HttpUpstreamModule Nginx documentation]. 80 80 81 To add a basic or digest authentication, you 'll have to provide a file as in the example above, created usinghtpasswd file.82 To make gunicorn listen on a unixsocket, add this option:81 To add a basic or digest authentication, you will have to provide a file as in the example above, created using the htpasswd file. 82 To make Gunicorn listen on a UNIX socket, add this option: 83 83 84 84 {{{#!sh … … 86 86 }}} 87 87 88 '''Note''': It seems the WSGI entry point does not handle the digest or basic http authentication. To ensure the authentication middleware is passed, you have to hack a little bit the`tracwsgi.py`:88 '''Note''': It seems the WSGI entry point does not handle the digest or basic http authentication. To ensure the authentication middleware is passed, you have to modify `tracwsgi.py`: 89 89 90 90 {{{#!python … … 105 105 }}} 106 106 107 '''Note''': if using digest authenticationyou must create the authentication handler outside of the application def, otherwise the !DigestAuthentication object won't retain state between requests.107 '''Note''': If you are using digest authentication, you must create the authentication handler outside of the application def, otherwise the !DigestAuthentication object won't retain state between requests. 108 108 109 109 {{{#!python