python web server questions

dalebryan1 at gmail.com dalebryan1 at gmail.com
Mon Dec 17 16:52:38 EST 2007


I am working on a task to display a wireless network nodes using
Google Earth (GE) with KML network links.  I am using a simple python
webserver (see code below) to serve up the python scripts as KML
output to GE for this.

import BaseHTTPServer
import CGIHTTPServer
class Handler(CGIHTTPServer.CGIHTTPRequestHandler):
    cgi_directories = ['/cgi-bin']
httpd = BaseHTTPServer.HTTPServer(('',8000), Handler)
httpd.serve_forever()

This works fine for my initial scripts, but now I thinking of
combining the python scripts into the server program and making things
more efficient.  The script file currently reads sensor data from
different I/O ports (GPS ->serial, network data -> ethernet).  I am
new to python, and was wondering if there might be a better way to run
the server side process than how I am doing it now:

1. GE client requests data through KML network link on a periodic
update interval
2. python webserver handles request and executes python script in cgi-
bin directory
3. python script reads sensor input from serial and ethernet ports and
writes data as KML output to GE client
4. repeat process at update interval

I am thinking if it would be better to make the process server-side
focussed as opposed to client side.  Have the server only update
sensor data to the client when there has been a change in sensor data,
and only send the data that has changed.  Has anyone had experience in
doing this with python that could point me in the right direction?

thx
Dale



More information about the Python-list mailing list