Wishful Coding

Didn't you ever wish your computer understood you?

Wordpress MU in Resin with Quercus

While researching Quercus today, I ran into some trouble running the new integrated Multi Site feature of Wordpress 3.0(previously a separate project known as Wordpress MU or WPMU for short) on Resin. Quercus is a PHP implementation written in Java that runs on any Java Servlet Container, including but not limited to Jetty, Tomcat or Resin. I took Resin for it was the easiest to setup and includes Quercus. Normally one would just use Apache and mod_php, but I also want to run Jython and Clojure projects, so I'm looking for a solution to combine these. Wordpress MU allows me to run multiple blogs on a single installation(as seen on wordpress.com), which I want to use for hosting websites for my clients. The problem with WPMU is that to map the different urls to one installation, some tricky mod_rewrite code is required for Apache, but since I'm using Resin here, I'll have to find another solution. There is a post on the Quercus wiki describing the process of setting up a Multi Site Wordpress installation, but this is for an old version of WPMU(before the merge) and an old version of Resin. After a good few hours of trying, I got it working with the latest version of Wordpress 3.0, Quercus 4.0.3 and Resin 4.0.7. Just follow the wiki, except for a few points: Note that I did not use the pro version, skipped the DNS stuff by using directory instead of subdomains in WP, I also skipped the chown stuff by removing this block from resin.xml:
<resin:if test="${resin.userName == 'root'}">
        <user-name>pepijndevos</user-name>
        <group-name>staff</group-name>
      </resin:if>
Posted

How to install Python/web.py on a shared host

In the past I have written a few Python web applications, but when I asked my host about Python, they told me they where specialized in PHP and nothing but PHP(that is why this site runs Wordpress). If your are lucky and have a very expensive dedicated server you can install whatever you want, but how about my poor projects? I'm not going to re-write them in PHP obviously. I figured that as long as you have a CGI bin, you can do whatever you want. I started writing a CGI script that would install Python and Web.py for me; Check out the resulting web.py example. This is the script that I came up with. It should be doable to customize this for Pylons, TurboGears, Django, or any other Python framework. You should at least fill in your own home directory twice, we're doing a Python installation inside you home directory.
#!/bin/sh

echo "Content-type: text/html

";

curl http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tgz | tar -zx
cd Python-2.6.4
./configure --prefix=/your/home/directory #change this to your home
make
make install
cd ..
curl http://www.saddi.com/software/flup/dist/flup-1.0.2.tar.gz | tar -zx
cd flup-1.0.2
/your/home/directory/bin/python setup.py install
cd ..
curl http://webpy.org/static/web.py-0.33.tar.gz | tar -zx
cp -r web.py-0.33/web .
Note that you should add .py as a CGI handler in your .htaccess file:
AddHandler cgi-script .py
Since our fresh Python installation is not on the PATH variable, you should include a shebang header in your scripts to point to the right path:
#!/your/home/directory/bin/python
Again, check the result!
Posted