Took another whack at getting PyBlosxom/SCGI working with Lighttpd,
this time with better success. (I'm still getting up-to-speed with Lighttpd). This is working with the
exact same SCGI setup I was working on the other day.
To elaborate a bit, the setup I'm trying to achieve is to:
Have the blog to be completely under "/blog/" in the URL namespace
Not get it confused with anything else that begins with "/blog" such as "/blog2".
Use "/blog/static/" URLs for serving static resources like CSS stylesheets
and images off the disk (instead of running those requests through PyBlosxom's CGI code).
This is what I ended up with, seems to work fairly well, and I'm impressed with how Lighttpd makes
it easy to put together a understandable configuration.
#
# External redirection to add a trailing "/" if exactly
# "/blog" is requested
#
url.redirect = (
"^/blog$" => "http://barryp.org:81/blog/",
)
#
# The PyBlosxom Blog, lives under the "/blog/" url namespace
#
$HTTP["url"] =~ "^/blog/" {
#
# Static resources served from the disk
#
$HTTP["url"] =~ "^/blog/static/" {
alias.url = ("/blog/static/" => "/data/blog/static/")
}
#
# Everything non-static goes through SCGI
#
$HTTP["url"] !~ "^/blog/static/" {
scgi.server = ( "/blog" => (
(
"host" => "127.0.0.1",
"port" => 8040,
"check-local" => "disable",
)
)
)
}
}
Running PyBlosxom through SCGI
Out of curiosity, ran the Apache Benchmark program ab on the plain CGI installation of PyBlosxom on my little server (-n 100 -c 10), and got around 1.5 requests/second. Decided to give SCGI a try, and got some better results.
Went about this based on what I had read in Deploying TurboGears
with Lighttpd and SCGI. Tried Lighttpd at first, and it mostly worked, but I've got an Apache setup right now,
so wanted to stick with that for the moment (and it seems a bit quicker anyhow). Basically started by
loading flup with easy_install.
easy_install flup
Copied the config.py and wsgi_app.py files from the PyBlosxom distribution
into a directory, and added this little script into that same directory:
Notice how the scriptName and bindAddress parameters in the Python code
are matched in the SCGIMount Apache directive. With this setup, running the same
ab benchmark yields about 10 to 15 requests/second - not too bad. Running the threaded SCGI
server (remove the _fork from the first import line) wasn't as good, only 3 or 8 requests/second.
The setup seems a bit shaky in that the benchmark values seem to keep decreasing with every run,
especially in the threaded mode. So there may be some problems in my setup or in flup/scgi/pyblosxom_wsgi.
Even if it was working fine, SCGI is probably overkill for
running PyBlosxom when you're not expecting a lot of traffic. And if you were, you'd probably
run it with --static to generate static pages. But it was a reasonable
thing to fool with for the day when you want to run a more dynamic WSGI app.
Trying PyBlosxom
Going to give PyBlosxom a try, seems like a pretty simple system for throwing together a simple blog. Right now simple sounds pretty good. A lot of the Python-related blogs I normally end up seeing seem to use this software, so I figure it can't be too bad. Things like Zope/Plone/Turbogears seem like way overkill for just a simple one-person setup.
I'm kind of interested in the idea of a blog as a resume, so I'll try to write down some of the things I've worked on or figured out.
Previously, I've put some things on Advogato, however
I always felt a bit guilty entering items that were too lengthy or not interesting enough for other readers. I guess that doesn't stop most bloggers, but at least on my own server I feel I can abuse it as much as I want.