nginx + gunicorn

An update

So, an early post covered how I ran nginx+gevent... but since, I've also dallied with gunicorn.

Here's my runit script:


cd /var/www/
. bin/activate
export DJANGO_SETTINGS_MODULE=myapp.settings
exec gunicorn_django -c gunicorn.conf

As you can see, it's very simple, and takes advantage of virtualenv.

Obviously, this requires a gunicorn config script:

user = 'www-data'
group = 'www-data'
proc_name = 'somewhere'
worker_class = 'gevent'
bind = 'unix:/var/www/'

def post_fork(server, worker):
    from psyco_gevent import make_psycopg_green
    make_psycopg_green()"Made Psycopg Green")

Now... most of that's fairly simple and obvious, except, perhaps, the end.... which is just cribbed from using psycogreen

comments powered by Disqus