[Tutor] NEWBIE is it possible to use HTML and Python together?

Robert Garber garber@centralcatholic.org
Fri, 22 Mar 2002 16:39:15 -0500


I willbe adding that book to my collection also. that will bring me up to 5 now.

there is no web server involved with this little thing.  it will be strictly in his own machine.
am i correct in assuming the following steps:
1. set up a server on his machine with a python script?
2. then set up the HTML to look at the server
3. have the server execute the rolling dice script
4. have server report the results back to the HTML

next problem. Python is not instaled on his lap top. I there a way to do this with out putting the complete python 2.1 in his machine?

thanks for your help, this is starting to sound like a bigger project then I first thought. I thought it would be simple...he writes the HTML, I write the dice script, embed the python script ( like Java?) in to the HTML frame...and play.

thanks again for your help. I am leaving school right now. On my way home, I am buying a new book. Glad I saw this one at Media Play a week ago, know right where to go. this will bring my python collection to 5 ( the new Deitel & Deitel book, A. Gauld book, Python in 24 hours (YUCK), O'Riley/Mark Lutz book Learning python)ANymore that you would recomend, I should consider?

Thanks
Robert

---------- Original Message ----------------------------------
From: Kirby Urner <urnerk@qwest.net>
Date: Fri, 22 Mar 2002 09:22:34 -0800

>At 07:40 AM 3/22/2002 -0500, you wrote:
>>I there any way to set the python up to run on a client side.
>>I don think it's planned to run on the web, it's just his own
>>little game. is there away to use something like py2exe to
>>solve this?
>>
>>Thank you for your time in helping me solve this.
>>Robert
>
>Is there a web server in this picture at all -- even just
>a local one on the same machine as the client?  It's
>perfectly possible for a standalone machine not permanently
>connected to the internet with static, public IP to run a
>web server "facing inward" (i.e. to be a "host" and to
>"run a web server" are not the same thing).
>
>Perhaps your friend is using HTML to sort of mock up an
>interface, i.e. is using the browser as a front end for
>an app?  This is trendy, as various flavors of XML for
>GUI-design are popping up and programmers will be taking
>this approach quite a bit.
>
>However, without a server in the picture, web pages need
>something running client side to be dynamic.  Either that,
>or use Python to take the place of the missing server,
>i.e. you could write a tiny server in Python and point
>the browser to it.  This is easier than it sounds.
>However, you should make sure this code never handles
>HTTP requests originating outside your box.
>
>For example, put some html file (say thefile.html) in
>your Python root directory and enter the following two
>lines of code in IDLE.  Then point your browser to
>http://127.0.0.1/thefile.html and it should come up in
>your browser:
>
> >>> import SocketServer.CGIHTTPServer
> >>> SocketServer.ThreadingTCPServer(('127.0.0.1',80),\
>       CGIHTTPServer.CGIHTTPRequestHandler).serve_forever()
>
>You may need to kill your Python process from outside
>when you're done with this demo.
>
>A good resource here is 'The Python 2.1 Bible' Chapter 15,
>from where I copied the above.  From here, you can go on
>to write CGI handlers that handle requests.
>
>Kirby
>
>