Drew Csillag formally released SkunkWeb 3.0 as an open source program on August 23rd. Csillag originally developed SkunkWeb as an in-house application server for StarMedia in 1998. His focus was on templating and scalability. He wanted it to be simple and easy to take in bites so you didn't have to understand the whole thing to use it. He also wanted it to be powerful, so it wouldn't be constraining. That cried out for Python, which is what he used.
There are many Python web application servers, and it seems inevitable that they will all be compared to Zope, Digital Creations' object publishing environment. Zope is the big boy of Python application servers. Csillag's announcements focused on how SkunkWeb differs from Zope, yet the two servers address different audiences. If you want content management tools for a complex web design team of artists, writers, and coders, or you want ready-to-use drop-and-run-with-it objects for your site, Zope is the thing. If you are a group of web developers with a love of rolling your own, a love of wide open spaces and no constraints, Zope isn't going to appeal. SkunkWeb will. In short, Zope's success depends on polished reusable objects and content management. SkunkWeb's success depends on its simplicity and scalable power. PHP, Mason, or (if you prefer Python) projects like Webware are SkunkWeb's real competitors.
To compile and run SkunkWeb 3.0, you need Python 2.1.1 and eGenix's mx BASE Package. You also need a Unix or Linux system. SkunkWeb is a forking server rather than a threaded one. Windows systems won't support it. SkunkWeb comes with its own http daemon. You can also use Apache, but SkunkWeb has some problems with mod_index and mod_dir, two popular Apache modules. You might need to disable them to work with SkunkWeb through Apache. To start out, I recommend using SkunkWeb's http daemon. By default it's set up to work with port 8080 so it need not interfere with an existing Apache installation.
SkunkWeb's templating language, STML, can be mixed with HTML. It
consists of tags like
<:import:> -- HTML tags with colons in them. Many of the tags are taken directly from Python, and you can use Python like syntax within the tags. If you already know Python, this works great for constructing a web page, but if you need a lot of coding the
syntax becomes annoying. Fortunately you can use Python
.py) files as well. This puts the full power of Python
at your immediate disposal. SkunkWeb recognizes two other kinds of
files: component files, which generate html, and data component files,
which return data objects. These can be written in STML or
Python. Support for other languages may be added in the future.
eGenix's mxDateTime tool is the primary reason you need the mxBase. SkunkWeb uses this tool to control the server's caching. SkunkWeb can cache the output of components, making subsequent calls of the same component very fast. The default cache time is 30 seconds. You can change this in the server defaults, but each component can set its own cache timeout as well. This gives you control over how often a component regenerates its content.
SkunkWeb has released a couple of related projects, PyDO -- Python Data Objects -- and SkunkDAV, a WebDAV tool. PyDO is an object-based interface to existing relational database servers written with database managers in mind. It provides an abstraction of the database work and makes writing SkunkWeb driven database applications easier, yet it is easy to peek under the hood and see what PyDO is doing. Because nothing is hidden, database managers can more easily optimize the database access. SkunkDAV is a Java2 WebDAV client with a built-in editor and browser. It was developed by Jacob Smullyan, who also wrote SkunkWeb's http daemon.
Even if you are currently satisfied with PHP, Mason, or Webware, you might want to peek at SkunkWeb for its scalability and extensibility. Beyond templating, for example, you can add services to the server through an Apachesque API. Being able to mix the SkunkWeb's templating language and Python is also a huge plus. SkunkWeb's PyDO, as a standalone tool, could be useful for many other projects as well. Though some of its documentation is sparse or non-existent, its templating language is fairly well documented, and if you know Python already, it is going to be very easy to understand. Geeknews, a demo that comes with SkunkWeb, shows how STML and Python work together. I think Csillag has succeeded in fulfilling his original objectives. SkunkWeb is simple, powerful, and easy to learn in bites.
Stephen Figgins administrates Linux servers for Sunflower Broadband, a cable company.
Read more Python News columns.
Return to the Python DevCenter.
Copyright © 2009 O'Reilly Media, Inc.