Ian Bicking: the old part of his blog

Spyce - the Python equivalent of PHP/JSP

As a Python lover who also uses PHP extensively, I find that Spyce ( http://spyce.sourceforge.net ) is the Python web programming solution that is closest in spirit to PHP. With Spyce, all the right ingredients that made for PHP's [initial] success, such as immediacy of learning and integration into an HTML page, are made available while straying as little as possible from how you normally do Python programming (read: nothing much new to learn).

Spyce's Pythonic design involves a small amount of carefully designed features which:

  1. provides powerful HTML-integration features more on par with JSP (such as rockin' custom tags) than PHP (whose tag-related features you need to boost with outside help such as Smarty)
  2. retains the ease and cleanliness of basic PHP
  3. lets you reuse what Python already does well, with the least distraction
  4. allows extension with template processors (such as Cheetah)

Spyce has been around for a while and mature and stable enough for 'heavy lifting'. It was what I settled on after evaluating roughly a dozen other Python web frameworks including CherryPy, Quixote, Skunk, Zope, and Webware, none of which, imo, offered the clarity and ease of HTML integration that PHP provides and thus were not satisfactory alternatives.

Spyce can be made to run on commodity hosting that supports CGI and Python (99.9% do) easily by:

  1. just copying over the Spyce files under a cgi-bin directory
  2. creating a 2-3 line .htaccess file in a directory where your .spy files will run

Voila! You now have Spyce working together with all the features that a Python program on that server has access to (including MySQL, SMTP, etc...)

Spyce can also work on top of fastCGI, mod_python as well as its own server proxying behind Apache or other web server.

Oh... and before I forget... if its default [[ and ]] delimiter tags turn you off, you can use the more conventional <% and %> instead.

The final icing on the cake is that the free SciTE ( http://www.scintilla.org ) editor can beautifully highlight HTML, Javascript and Spyce code separately when you use <% %> and enable 'asp.default.language=3' in its 'html.properties' configuration file!

Comment on Why Web Programming Matters Most
by Jonathan P.


Well, I agree - spyce is fine. Howerver, since I have found CherryPy...No. Spyce is -too- close to php programming for me. I think that the way cp2 is going is better for web programming. However, there is one thing cp needs - mod_cherrypy :-]
# Almad

I used Spyce, but now mod_python supports inline code, so for med Spyce became redundant.
# Rune