Pylons on cherokee
Check out the new site at https://rkblog.dev.
14 July 2008
Comments
Pylons and Cherokee with SCGI
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 }
UserDir public_html { Directory / { Handler scgi { Server localhost:8080 } }
- Find:
Directory / { Handler common }
[server:main] use = egg:PasteScript#flup_scgi_thread host = localhost port = 8080
paster serve --reload plik.ini
- Start cherokee:
/etc/something/cherokee start /etc/init.d/cherokee start (gentoo) /etc/rc.d/cherokee start (arch)
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:
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
Cleaning cherokee
You may want to remove PHP, /cgi-bin and other config entries that aren't needed.
RkBlog
Check out the new site at https://rkblog.dev.
Comment article