<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Fun with ones and zeros - pyblosxom</title>
<subtitle>Barry&#039;s notes on computer software and hardware</subtitle>
<link href="/blog/tags/pyblosxom"></link>
<updated>2026-05-05T10:02:45-07:00</updated>
<id>urn:uuid:bab826ee-207a-94b2-bda4-a6282f32588d</id>
<entry>
<title>Getting PyBlosxom SCGI working under Lighttpd</title>
<link href="/blog/entries/lighttpd_scgi_pyblosxom"></link>
<id>urn:uuid:f080ae96-dab4-1408-4bcc-d5600bead837</id>
<updated>2006-01-17T09:13:00-08:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">
&lt;p&gt;Took another whack at getting PyBlosxom/SCGI working with &lt;a href=&quot;http://www.lighttpd.net&quot;&gt;Lighttpd&lt;/a&gt;, 
   this time with better success. (I&#039;m still getting up-to-speed with Lighttpd).  This is working with the 
   exact same SCGI setup I was &lt;a href=&quot;http://barryp.org/blog/python/pyblosxom_scgi.html&quot;&gt;working on the other day&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;To elaborate a bit, the setup I&#039;m trying to achieve is to:
&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;
     Have the blog to be completely under &amp;quot;&lt;code&gt;/blog/&lt;/code&gt;&amp;quot; in the URL namespace
 &lt;/li&gt;

 &lt;li&gt;
     Not get it confused with anything else that begins with &amp;quot;/blog&amp;quot; such as &amp;quot;/blog2&amp;quot;.
 &lt;/li&gt;

 &lt;li&gt;
     Use &amp;quot;&lt;code&gt;/blog/static/&lt;/code&gt;&amp;quot; URLs for serving static resources like CSS stylesheets 
  and images off the disk (instead of running those requests through PyBlosxom&#039;s CGI code).
 &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is what I ended up with, seems to work fairly well, and I&#039;m impressed with how Lighttpd makes
   it easy to put together a understandable configuration.
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#
# External redirection to add a trailing &amp;quot;/&amp;quot; if exactly 
# &amp;quot;/blog&amp;quot; is requested
#
url.redirect = (
                &amp;quot;^/blog$&amp;quot; =&amp;gt; &amp;quot;http://barryp.org:81/blog/&amp;quot;,
               )

#
# The PyBlosxom Blog, lives under the &amp;quot;/blog/&amp;quot; url namespace
#
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;^/blog/&amp;quot; {
    #
    # Static resources served from the disk
    #
    $HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;^/blog/static/&amp;quot; {
        alias.url = (&amp;quot;/blog/static/&amp;quot; =&amp;gt; &amp;quot;/data/blog/static/&amp;quot;)
    }

    #
    # Everything non-static goes through SCGI
    #
    $HTTP[&amp;quot;url&amp;quot;] !~ &amp;quot;^/blog/static/&amp;quot; {
        scgi.server = ( &amp;quot;/blog&amp;quot; =&amp;gt; (
                                     (
                                     &amp;quot;host&amp;quot; =&amp;gt; &amp;quot;127.0.0.1&amp;quot;,
                                     &amp;quot;port&amp;quot; =&amp;gt; 8040,
                                     &amp;quot;check-local&amp;quot; =&amp;gt; &amp;quot;disable&amp;quot;,
                                     )
                                   )
        )
    }
}
&lt;/code&gt;&lt;/pre&gt;

</content>
</entry>
<entry>
<title>Running PyBlosxom through SCGI</title>
<link href="/blog/entries/pyblosxom_scgi"></link>
<id>urn:uuid:12b45ca9-c1dd-8584-84ea-d39ce023eaa5</id>
<updated>2006-01-15T20:19:48-08:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">
&lt;p&gt;Out of curiosity, ran the Apache Benchmark program &lt;code&gt;ab&lt;/code&gt; on the plain CGI installation of PyBlosxom on my little server (&lt;code&gt;-n 100 -c 10&lt;/code&gt;), and got around 1.5 requests/second.  Decided to give &lt;a href=&quot;http://www.mems-exchange.org/software/scgi/&quot;&gt;SCGI&lt;/a&gt; a try, and got some better results.
&lt;/p&gt;
&lt;p&gt;Went about this based on what I had read in &lt;a href=&quot;http://cleverdevil.org/computing/34/&quot;&gt;Deploying TurboGears 
   with Lighttpd and SCGI&lt;/a&gt;.  Tried Lighttpd at first, and it mostly worked, but I&#039;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 &lt;a href=&quot;http://www.saddi.com/software/flup/&quot;&gt;flup&lt;/a&gt; with &lt;a href=&quot;http://peak.telecommunity.com/DevCenter/EasyInstall&quot;&gt;easy_install&lt;/a&gt;.
&lt;/p&gt;
&lt;pre&gt; 
    easy_install flup
&lt;/pre&gt;
&lt;p&gt;Copied the &lt;code&gt;config.py&lt;/code&gt; and &lt;code&gt;wsgi_app.py&lt;/code&gt; files from the PyBlosxom distribution
   into a directory, and added this little script into that same directory:
&lt;/p&gt;
&lt;div class=&quot;source&quot;&gt;&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;#!/usr/bin/env python&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;sys&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;flup.server.scgi_fork&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WSGIServer&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wsgi_app&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;application&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WSGIServer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
                 &lt;span class=&quot;n&quot;&gt;scriptName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;/blog&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
                 &lt;span class=&quot;n&quot;&gt;bindAddress&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;127.0.0.1&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8040&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ret&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ret&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Installed mod_scgi built for Apache2 and added two lines to the config
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;LoadModule scgi_module libexec/apache2/mod_scgi.so

SCGIMount /blog 127.0.0.1:8040
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Notice how the &lt;code&gt;scriptName&lt;/code&gt; and &lt;code&gt;bindAddress&lt;/code&gt; parameters in the Python code
    are matched in the &lt;code&gt;SCGIMount&lt;/code&gt; Apache directive.  With this setup, running the same 
   &lt;code&gt;ab&lt;/code&gt; benchmark yields about 10 to 15 requests/second - not too bad.  Running the threaded SCGI 
   server (remove the &lt;code&gt;_fork&lt;/code&gt; from the first import line) wasn&#039;t as good, only 3 or 8 requests/second. 
&lt;/p&gt;
&lt;p&gt;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.
&lt;/p&gt;
&lt;p&gt;Even if it was working fine, SCGI is probably overkill for 
   running PyBlosxom when you&#039;re not expecting a lot of traffic.  And if you were, you&#039;d probably 
   run it with &lt;code&gt;--static&lt;/code&gt; 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.
&lt;/p&gt;
</content>
</entry>
<entry>
<title>Trying PyBlosxom</title>
<link href="/blog/entries/firstpost"></link>
<id>urn:uuid:96bf1d71-9d26-0527-a40f-f19637e2c465</id>
<updated>2006-01-13T13:23:00-08:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">
&lt;p&gt;Going to give &lt;a href=&quot;http://pyblosxom.sourceforge.net/&quot;&gt;PyBlosxom&lt;/a&gt; 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&#039;t be too bad.  Things like Zope/Plone/Turbogears seem like way overkill for just a simple one-person setup.
&lt;/p&gt;
&lt;p&gt;I&#039;m kind of interested in the idea of a &lt;a href=&quot;http://weblog.infoworld.com/udell/2005/12/29.html&quot;&gt;blog as a resume&lt;/a&gt;,  so I&#039;ll try to write down some of the things I&#039;ve worked on or figured out.
&lt;/p&gt;
&lt;p&gt;Previously, I&#039;ve put some things on &lt;a href=&quot;http://advogato.org/person/barryp/&quot;&gt;Advogato&lt;/a&gt;, however
   I always felt a bit guilty entering items that were too lengthy or not interesting enough for other readers.  I guess that doesn&#039;t stop most bloggers, but at least on my own server I feel I can abuse it as much as I want.
&lt;/p&gt;


</content>
</entry>
</feed>