[Tutor] HTML Generating

Sheila King sheila@thinkspot.net
Tue, 03 Jul 2001 14:15:36 -0700


In order to have it "execute in a browser", you would need to have a web
server, and have your script in the cgi-bin of the website and call the
script by putting a URL that points to the script into the Location in
your web browser.

Are you trying to learn CGI programming? (This is how you get programs
to run on a web page.) Or are you just trying to get your feet wet with
programming. CGI programming isn't hard, but it is something additional
to learning just the "programming" part.

If you want to get it to run on your WIN95 machine, you would need to
install a web server on your home machine, get it running, and then have
a link to the script on your machine.

This is probably not very clear, but I'm sure we can provide more
information if you are interested. Let us know.

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/


On Tue, 3 Jul 2001 14:49:25 -0600, "Tobin, Mark"
<Mark.Tobin@attcanada.com>  wrote about [Tutor] HTML Generating:

:OK... how come when I make a python script such as the one Sheila King
:posted (below) and execute it through my local IE5.5, it executes in a
:python window (DOS window) as opposed to in the browser?  I'm using PY2.1 on
:a WIN95 machine with IE5.5.  I don't really know how to express this any
:better (I'm just beginning to pick up some of this new language called
:"programerese"), but if this isn't clear I'll try again...
:
:Thanks in advance,
:
:Mark
:
:#!/usr/bin/env python
:
:import os
:
:print "Content-type: text/html\n\n"
:
:print "<html>\n"
:
:print "<Head>"
:print "<Title>Obligatory Python Test Script</Title>"
:print "</Head>\n"
:
:print "<Body>\n"
:print "<H3>Hello</H3>"
:print "<b>This is the obligatory<br> Python 'Hello\' testscript<br></b>"
:print "<i>Ta-da</i><br><br>"
:
:print "NEW STUFF: testing environment variables<br>"
:print os.environ["REMOTE_ADDR"],"<br><br>"
:print "<p>And now, all the environment variables:<br>"
:print "<b>",
:for el in os.environ.keys():
:	print el, " = ", os.environ[el], "<br>"
:print "</b>"
:print "THE END"
:
:print "</body>\n</html>"
:
:_______________________________________________
:Tutor maillist  -  Tutor@python.org
:http://mail.python.org/mailman/listinfo/tutor