Next Gen Web Dev: Playing with Python Twisted/Nevow/Athena

AthenaI had the privilege of being introduced to the next generation of bleeding edge web development tools this weekend. This post is mainly about DivMod’s “Nevow” which is a web templating framework, running on Twisted Matrix’s Twisted Webserver and using DivMod’s “Athena” for asynchronous AJAX- and COMET-style browser communications.

If you are familiar with web dev, you may immediately develop a headache on the mentioning of AJAX, but believe me if I say that not only does Nevow not induce migraines, it gets you more and more excited as you realise its potential.

I really cannot properly express how nice it is to work with these tools here, so please take a moment to skim through this (very) short tutorial on creating an AJAX style chat server/client using Athena: http://divmod.org/users/oubiwann/howto/chattutorial/part01/index.html

As a first attempt, I created an AJAX style event notification system:  A site is provided with two children: /alerts and /event . When an arbitrary child page of /event is visited, such as /event/anyrandomword, a new event is created with the name “anyrandomword”. Visiting /alerts will display a list of events as they are created IN REAL TIME (without a page refresh) by anybody visiting /event/NewEventName from anywhere.

I recommend you read the source from the bottom up, most of it should be self-explanatory. The python source is available here: myelement.tac.py (About 100 lines without comments). Also required is the javascript source for adding table rows and the nice background fade-in effect: mymodule.js and an xhtml template for the alert form: tabletemplate.html

Here is the complete package, better named, better structured, but without comments: firstattempt.tar

Further Reading:
http://divmod.org/trac/wiki/DivmodNevow/Tutorial
http://divmod.org/trac/wiki/DivmodNevow/Athena/Tutorials/LiveElement
http://open.thusa.co.za/enamel

1 comment so far ↓

#1 Duncan McGreggor on 07.03.08 at 12:04 am

Thanks for the nice write-up! Glad you enjoyed it… and it’s nice for our stuff to get some recognition as “next gen” ;-)

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image