Saturday, July 12, 2008

Learning to configure django with lighttpd

So far I'm not having much luck setting up django with lighttpd. Followed the official docs here: http://www.djangoproject.com/documentation/fastcgi/ . Almost got it but when I try to access is says that the connection is refused because permission is denied. From http://home.badc.rl.ac.uk/lawrence/blog/2006/10/26/exploring_web_server_backends_-_installing_fastcgi_and_lighttpd I get the idea to `sudo su www-data` to start as the same user as lighttpd. But it can't write to the disk so I created a folder and chown it to www-data. Then rewrote the start-up script and configuration to create the socket and pid files in there. It works. But now I have a problem with the redirect. The system was supposed to run under a subfolder. But when I go to the subfolder/admin it gets redirected to admin. Which of course does not exists. Wondering whether I have to redirect admin too. But that seems ridicoluous. Whichever it I've got to keep on trying.

*Update - Found http://www.cyberciti.biz/tips/configure-lighttpd-alias-mod_alias.html which explains a bit more about the mod_alias directive. So it was because I needed to use 'alias.url +=' rather than 'alias.url ='. At the least now the media looks kinda right.

**Update - Finally asked on irc and got the subdirectory working. Just modify the urls in urls.py so that django itself will translate it properly. Fuh..

0 comments: