Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python server side AJAX library?

Tags:

python

ajax

I want to have a browser page that updates some information on a timer or events. I'd like to use Python on the server side. It's quite simple, I don't need anything massively complex.

I can spend some time figuring out how to do all this the "AJAX way", but I'm sure someone has written a nice Python library to do all the heavy lifting. If you have used such a library please let me know the details.

Note: I saw how-to-implement-a-minimal-server-for-ajax-in-python but I want a library to hide the implementation details.

like image 854
Nick Avatar asked Apr 02 '09 14:04

Nick


2 Answers

AJAX stands for Asynchronous JavaScript and XML. You don't need any special library, other than the Javascript installed on the browser to do AJAX calls. The AJAX requests comes from the client side Javascript code, and goes to the server side which in your case would be handled in python.

You probably want to use the Django web framework.

Check out this tutorial on Django tips: A simple AJAX example.

Here is a simple client side tutorial on XmlHTTPRequest / AJAX

like image 111
Brian R. Bondy Avatar answered Sep 30 '22 19:09

Brian R. Bondy


You can also write both the client and server side of the ajax code using python with pyjamas:

Here's an RPC style server and simple example:

http://www.machine-envy.com/blog/2006/12/10/howto-pyjamas-pylons-json/

Lots of people use it with Django, but as the above example shows it will work fine with Pylons, and can be used with TurboGears2 just as easily.

I'm generally in favor of learning enough javascript to do this kind of thing yourself, but if your problem fits what pygjamas can do, you'll get results from that very quickly and easily.

like image 39
Mark Ramm Avatar answered Sep 30 '22 18:09

Mark Ramm