6/03/2005

Getting started with Nevow and LivePage

I'm still working my way through the ropes of Nevow (web-app dev toolkit) and LivePage (client/server stuff) and thought I'd share a quick getting started guide.

Setup environment:
Generally the easiest way to install python packages is to run "python setup.py install" (with root privileges)
To see the code run execute: "twistd -noy firsttest.tac" and twisted will start a server on port 8080. Point your browser to http://localhost:8080/

One of the first things that's important if you come from a PHP/Apache background (like myself) is url's are completely virtual when using nevow. Pointing your browser to http://localhost:8080/index.php will do nothing unless you have a function or object specified in your root document object to handle "index.php" (generally it makes sense to just have /index and have no file extensions)

I've tried to over-comment the two files included in the example. The .tac file is nothing more than a Python file with a different extension indicating it's an application that can be run with "twistd". It defines a root object that is attached to a server object. The root object defines the structure and mechanics of the root page (locahost:8080/).

So what does this little application do?
This very basic application loads a template (firsttest.xhtml) and then fills in the blanks. The template defines "slot" and "render" components that define where nevow can take over and dictate the content.
In addition we build a very simple form that when submitted calls a function in the server. The server then responds by telling the client to display an alert box with a string. That's right, the whole AJAX thing is being done in an OO fashion with clear distinction between client and server roles, with the power of Python!
Although only a primitive javscript alert() box is being displayed there is a permanent link established between the client and server allowing for instantaneous communication. Nevow comes with an example chat application called "Chatola", it's well worth getting that to run with a couple of machines and seeing the pure speed that is possible with Nevow and LivePage.

I'm still getting my head around some of the concepts here, but this seems like the ideal platform for developing future generation web applications. I'm still unsure how to structure a complete application, but I'm sure this will become clearer once writing a few test apps and walking through some more code.

2 Comments:

Anonymous Anonymous said...

I have been to your site and I too am working very hard at visa master card username checkout adsense to increase my revenue. I am also looking into many NEW ways to utilize the design to further direct people to follow my ads.
visa master card username checkout adsense

10:06 AM  
Blogger blaze said...

Great info about adsense free google google googleadsensesearch.com money I have a lage interest also and have a site about adsense free google google googleadsensesearch.com money please feel free to check it out.

5:24 PM  

Post a Comment

<< Home