I’m experimenting with Vellum, Stuart Langridge’s weblog tool written in Python. It’s an very nice piece of code; a geek tool for geek bloggers. Although I don’t like funky caching, its other features are impressive; and it keeps getting better with each new release.
As I didn’t have a Linux box in hand when Vellum was released, I tried to get it running on Windows. The first releases refused to cooperate, but the current version (1.0a5) worked like a charm. I needed to make some changes in both the web server configuration and Vellum itself, but now it’s running nicely under Windows 2000 Server. I’m using Apache 2.0.44 and IIS 5.0, but I believe the instructions bellow are valid for Windows NT 4, Apache 1.3.x, and IIS 4.0 too.
Running Vellum on Windows
Setting up the proper environment
First, we need a proper Vellum environment. I have Python installed to d: oolspython22. I will refer to this path below as $(PYTHON). This is just a reference. The real path must be entered on the configuration files.
I created a directory named d:domainsvellum to contain the Vellum application and accessory files. This path will be referred to as $(VELLUM_HOME) below. Again, this is just a reference. Use the real path in the configuration files.
Under $(VELLUM_HOME), I created three other directories:
- $(VELLUM_HOME)vellum_app
- This directory holds the Vellum application itself. I copied the contents of the Vellum distribution to it.
- $(VELLUM_HOME)vellum_data
- This directory hols the Vellum database. The first time Vellum runs, it will create the necessary files here. This directory must be entered as the DatabaseDir in the Vellum configuration file, which is located in $(VELLUM_HOME)vellum_appvellum.config.
- $(VELLUM_HOME)vellum_static
- This is the blog directory itself. Vellum wil generate static files in this directory as they are requested. You must copy site.css and site.htaccess from $(VELLUM_HOME)vellum_app emplates to here. The file site.htaccess must be renamed to .htaccess. If Windows refuses to rename it, open the file on Notepad and save it under a new name. This directory must be provided later in the blog configuration under Vellum.
Setting up Apache
Setting up Apache to run Vellum is quite easily. Just add the following lines to its configuration files. The lines commented below are optional. The first should be included if you plan running additional Python scripts under Apache. The second should be included only if it’s not already present in the configuration files.
Alias /vellum/ "$(VELLUM_HOME)/vellum_app/"
Alias /blog/ “$(VELLUM_HOME)/vellum_static/”
# AddHandler cgi-script .py
# AddHandler cgi-script .cgi
<Directory “$(VELLUM_HOME)/vellum_app”>
Options +ExecCGI
Order allow,deny
Allow from all
AllowOverride All
</Directory>
<Directory “$(VELLUM_HOME)/vellum_static”>
Order allow,deny
Allow from all
AllowOverride all
</Directory>
Note that your must use slashes in the paths above. Some Apache distributions will complain if backslashes are used.
You also need to change the first line in $(VELLUM_HOME)/vellum_app/vellum.cgi to point to the proper interpreter path under Windows. It should read:
#!$(PYTHON)python.exe -u
Restart Apache. Vellum is now ready to run under Apache.
Setting up IIS
Setting up IIS is a bit more complicated, since it handles 404 errors — which Vellum uses for funky caching — in a different way. So, Vellum will need to be slightly modified to parse IIS’s 404 error redirections. But IIS must be configured to run Vellum in first place.
To do so, open the IIS administrative tool, and create two virtual directories.
One, named vellum, should point to $(VELLUM_HOME)vellum_app. The other, named blog, will point to $(VELLUM_HOME)vellum_static.
Open the properties of the vellum virtual directory, and click on the Configuration button. Now, click on the Add button. This will create a new script mappin for IIS. Enter the required information:
Executable: $(PYTHON)python.exe -u %s %s
Extension: .cgi
Limit to: GET,HEAD,POST,TRACE
The other fields should be left in their default values. You can add new mappings for .py and .pyc if you want.
Now, open the properties of the blog virtual directory, and choose the Custom Errors tab. Scroll down to the 404 error entry and edit it to the following values:
Message Type: URL
URL: /vellum/vellum.cgi
In a last step, the Vellum application itself must be changed. Open the files function.py in the $(VELLUM_HOME)vellum_app directory under the Vellum application directory:
In line 50, the code that reads
if os.environ.has_key("QUERY_STRING"):
qs = os.environ["QUERY_STRING"]
qsd = cgi.parse_qs(qs)
if qsd.has_key(”a”):
action = qsd["a"]
if type(action) == type([]):
action = action[0]
must be changed to:
if os.environ.has_key("QUERY_STRING"):
qs = os.environ["QUERY_STRING"]
if qs[0:3] == “404″:
action = “build”
os.environ["REDIRECT_URL"] = qs[4:]
else:
qsd = cgi.parse_qs(qs)
if qsd.has_key(”a”):
action = qsd["a"]
if type(action) == type([]):
action = action[0]
Vellum is now ready to run under IIS.
Running Vellum
Now Vellum can be used. Assuming your server is local, open http://localhost/vellum/vellum.cgi in your browser, and configure Vellum as you need.
When creating the first blog, you will need to point the parameters named “Blog static files directory” to the previously created static files directory, which is $(VELLUM_HOME)vellum_static.
After configuring a new blog and creating some entries, open http://localhost/blog/index.html, and see your new blog.
Have fun. If you spot some error in the instructions above, or Vellum fails to run, let me know, and I will try to help you.