Maru's world
World of tonic Fluff

Sat, 17 Nov 2007

Pyblosxom and site news

Long time no pyblosxom related info, I know.

Pyblosxom:

Will more or less asked me to join the pyblosxom development team. Well it was more or like "Hey, what's your sourceforge username I'll add you as developer". My first task is to take a look at the setuptools related config and update it.

Site:

As for the site news. Well the link to scenemusic is no longer there but you can now see, what I was listening to recently. Kudos to last.fm to make this possible. The way I did it was pretty simple in the end, a more detailed description will follow.

Ok, that's it for now, I hope you enjoyed the show and see you around.

Fri, 11 May 2007

Running pyblosxom under mod_python+WSGI

Since I always hated my CGI set-up here I took the plunge and tried to get pyblosxom running with WSGI. This is more or less a short HOWTO that shows how I did it. I am not sure if this is the best way to do it but it works for me.

Requirements:

  • WSGI

    This comes bundled with the latest python releases, if yours is older the easiest solution is to use easy_install. Just download and install it if you haven't done yet and then call

easy_install wsgiref

Setup:

Put mp_wsgi_handler.py, wsgi_app.py and your config.py in the same directory. Follow the directions in the wsgi_app.py file and put the <Location> entries in your httpd.conf file. Here it is once more. Do not forget to change PythonPath so all the required files are found.

<Location /weblog>
      PythonDebug Off
      SetHandler python-program
      # set PythonPath to the folders containing the files.
      PythonPath "['/path/to/mp_wsgi_handler', '/path/to/wsgi_app']+sys.path"
      PythonHandler mp_wsgi_handler::wsgi_handler
      # This should be the same as the Location above
      PythonOption ApplicationPath /weblog
      PythonOption application wsgi_app::application
</Location>

That's it you can now access your blog on your server via /weblog. But what if you do not want to use http://<servername>/weblog everytime?

I wanted to do exactly that. My first try was to change

<Location /weblog>

to

<Location />

This more or less worked, but since mod_python now took all requests I was not able to serve static files. I reverted the change and added some .htaccess entries instead.

.htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(?!weblog)(.*)$ /weblog/$1 [QSA,L]

So what are these entries doing?

If the request is not an existing file or directory

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]

OR it is the base url

RewriteCond %{REQUEST_URI} ^/$

rewrite it to /weblog but only if it isn't already /weblog

RewriteRule ^(?!weblog)(.*)$ /weblog/$1 [QSA,L]

Difficult yes, working yes, solveable in a better way maybe but I do not know how. :)

If you have any questions or comments do not hesitate to ask me.

Thu, 29 Dec 2005

New flavour layout

So I did what a had to do and revived my 3 year old pyblosxom layout. After some fiddling around with some div's I think it is ready to be looked at. What do you think? This is the first day of my holidays so expect more to come, or not.

Sat, 24 Dec 2005

Guilty playground pleasure

First post with the new/old blog system. I used pyblosxom before, then took a break, switched to wordpress and then once more came back to pyblosxom. There are several reasons for it.

  1. Ease of use

    Although the setup seems more complicated, pyblosxom is easier to use. All you have to do is to create text files. Wordpress on the other hand, while easy to set-up, is operated via a web interface. Yes of course you can use one of the available blog editors to create new entries or even use the mail interface, but then it gets more complicated.

  2. Pythonic flavour

    So you edit you posts with a nice editor upload it to your blog/database and are happy with it. If you like it this way go on and use other blogging tools. Pyblosxom on the other hand is very close to the first blogging system widely used blosxom with the difference that it is written in python instead of perl. If you want to use blosxom instead of pyblosxom go on and do it I won't stop you. The thing is, blogging started as a fast way to get your ideas/thoughts/ramblings postet with out much thinking about the layout. We should really go back to the basics and do this.

  3. Funkiness

    Databases and PhP are really great fun but what nothing beats playing with Python.

To be continued......