[Tutor] web site redirection to Python script

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Tue, 11 Dec 2001 18:06:35 -0800 (PST)


On Tue, 11 Dec 2001, Lloyd Kvam wrote:

> I wrote some python scripts for reporting survey results from an SQL
> server. Now they would like these to scripts to be available from a
> web site. Unfortunately, the ISP hosting the web site has not yet
> installed Python. I have setup a RedHat Linux server with Python.  
> Now I need to set up a Perl(?) script on the web site to forward
> report requests to my "Python Server" which will process the requested
> data, create an HTML report, and send the HTML report to the
> requestor.
> 
> PC/Browser >=reportRequest=> www.HowsYourHealth.org >=reportRequest=>
> "PythonServer"

This sounds reasonable.  Should the PC/Browser be aware that they're
bouncing to the PythonServer page, or should it appear that everything's
coming from www.howsyourhealth.org?  If it's ok to do a simple redirect,
then you can have your script on www.howsyourhealth.org do something like:

###
#!/usr/bin/perl -w
print "Location: PythonServer\n\n"
###

This sends the user right off to your PythonServer.  Afterwards, since the
user is directly talking to PythonServer, things should be ok.

Diagramically, this looks sorta like this:

    PC/Browser ----> www.HowsYourHealth.org 
        ^            "Talk to PythonServer instead."
        |
        |
        |
        +----------> PythonServer



> I need advice as to how the web server (Linux/Apache/Perl) can forward
> the request to the "Python Server".  Or tell me there is a better way
> to do this.

But perhaps you might want to make this more transparent, so that the user
is never aware of PythonServer's existance; that is, maybe we want
something like this:

    PC/Browser <-----> www.HowsYourHealth.org <-----> PythonServer