We will configure cherokee to server django project using SCGI protocol. Cherokee will also serve static files (media files)
- Install
flup module:
easy_install flup
- Install cherokee if you haven't done that yet. Note that when compiling from source you can explicitly enable SCGI and FastCGI support:
./configure --enable-scgi --enable-fcgi
- In gentoo use:
USE="fastcgi scgi" emerge cherokee
- In
/etc/cherokee you will find all cherokee config files. Edit
/etc/cherokee/sites-enabled/default (if not present symlink default from
sites-available).
- Find:
DocumentRoot /var/www/localhost/htdocs
- Change to a path to your project, for example: /home/user/djangoProject/
- Find:
UserDir public_html {
Directory / {
Handler common
}
- Change to:
UserDir public_html {
Directory / {
Handler scgi
{
Server localhost:8080
}
}
- Where
localhost:8080 is host and port of Paste/SCGI server that cherokee will try to use.
- Find:
Directory / {
Handler common
}
- And remove it.
- Edit your project *ini file and change
use in
[server:main]:
[server:main]
use = egg:PasteScript#flup_scgi_thread
host = localhost
port = 8080
- Run Paste server:
paster serve --reload plik.ini
- Start cherokee:
/etc/something/cherokee start
/etc/init.d/cherokee start (gentoo)
/etc/rc.d/cherokee start (arch)
- Open http://localhost/ - your pylons project under Cherokee should be up and running....
If you use Pylons <= 0.9.2 there is a Pylons bug -
check it
To "fix" it, find in your Pylons install (/usr/lib/python/site-packages/....) file
wsgiapp.py. Open and find:
if '_method' in environ['QUERY_STRING'] and req.GET.has_key('_method'):
Change to:
if req.GET.has_key('_method'):
And save. Done
You may want to remove PHP, /cgi-bin and other config entries that aren't needed.
- Added: 14.07.2008 by riklaunim