This is how I run my django applications in cherokee

First the cherokee config is simple, I run a local interpreter
(cherokee starts the web app) as user damjan:

r...@jeos:~# grep '!11!' /etc/cherokee/cherokee.conf
source!11!env_inherited = 0
source!11!host = 127.0.0.1:37116
source!11!interpreter = /home/damjan/django-app/run.sh --socket 127.0.0.1:37116
source!11!nick = DjangoApp
source!11!type = interpreter
source!11!user = damjan

Matched under the path (or directory as cherokee calls it) /myapp, set
as a uwsgi handler. Everything else is standard:

r...@jeos:~# grep '!160!' /etc/cherokee/cherokee.conf
vserver!10!rule!160!handler = uwsgi
vserver!10!rule!160!handler!balancer = round_robin
vserver!10!rule!160!handler!balancer!source!1 = 11
vserver!10!rule!160!handler!check_file = 0
vserver!10!rule!160!handler!error_handler = 1
vserver!10!rule!160!match = directory
vserver!10!rule!160!match!directory = /myapp

And this is the run.sh script that starts the Django app with uwsgi:

#!/bin/sh
DIRNAME=`dirname $0`
cd $DIRNAME

export PYTHONUSERBASE=$DIRNAME/env
export UWSGI_MODULE="django.core.handlers.wsgi"
export UWSGI_CALLABLE="WSGIHandler()"
export DJANGO_SETTINGS_MODULE="myapp.settings"
exec /usr/local/bin/uwsgi "$@"

Django is installed in /home/damjan/django-app/env with:
$ export PYTHONUSERBASE=/home/damjan/django-app//env
$ pip install Django --install-option=--user

The django application itself is in /home/damjan/django-app/myapp/


ps.
pep-370 only works in python 2.6 and better, a writeup about it and pip is here:
http://damjan.softver.org.mk/wiki/pep-370

-- 
damjan
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to