[Tutor] making a python program part of xhtml

Mike Hansen mhansen at cso.atmel.com
Thu Jun 8 18:59:57 CEST 2006


 

> -----Original Message-----
> From: tutor-bounces at python.org 
> [mailto:tutor-bounces at python.org] On Behalf Of Emily Fortuna
> Sent: Thursday, June 08, 2006 7:20 AM
> To: tutor at python.org
> Subject: [Tutor] making a python program part of xhtml
> 
> Hola everyone,
> I'm working on creating a webpage in which a user can submit 
> data into 
> fields to be held in a database (there are other details, but this is 
> the gist of the idea), and I need to use python.  I am 
> unfamiliar with 
> manipulating data and web apps as a whole (and new to 
> python), so I have 
> been encountering much unfamiliar terrain.  I _think_ I want 
> to somehow 
> embed the python into the page, but I'm really not sure how 
> to do it.  
> After googling I found some programs that generate xhtml from python, 
> but I don't think that is what I want, or is it?  Your help 
> is appreciated!
> Emily
>

Although you can embed python in a web page to be run on a server, you
probably don't want to do that.(It can get pretty messy.)

What I'd suggest is creating a web page that calls a python program on the
server and processes form fields in the web page. The python program would
save the data in the database.

[web page] -> [python program on server] -> [database]

Look at the FORM tag in HTML/XHTML. Also look at the cgi module for Python.
I think there's some web topics on the Python web site that might point to
articles about doing simple cgi stuff in Python.

http://wiki.python.org/moin/CgiScripts

http://www.devshed.com/index2.php?option=content&task=view&id=198&pop=1&page
=0&hide_js=1

Is an article on cgi programming with Python.

Mike



More information about the Tutor mailing list