Executing a python script from an HTML link?

Andrew Chalk achalk at XXXmagnacartasoftware.com
Wed Sep 24 11:13:24 CEST 2003


Thanks!
"Alan Kennedy" <alanmk at hotmail.com> wrote in message
news:3F7089DA.EB6E9969 at hotmail.com...
> [Andrew Chalk]
> > I want to run the script on the server.
>
> Then you will need to figure out how to run the script on the server
> ;-)
>
> If you're not aware of how to do this, then it's probably best for you
> to read up on CGI, which is way of getting web servers to execute
> scripts (in any language) when the scripts URL is requested.
>
> > The problem is that I don't
> > have an html page as an HREF. Viz:
> >
> > <tr><A HREF="Fred.htm">Fred</A>
> > What replaces Fred.htm to invoke a server-side script?
>
> Whatever is the URL of your script on your server. Examples include
>
> http://www.mydomain.com/cgi-bin/myscript.py
> http://www.mydomain.com/cgi-bin/myscript.cgi
> http://www.mydomain.com/cgi-bin/myscript.py?paramA=v1&paramB=v2
>
> Your python script should then generate (i.e. print out) an HTML page
> when it is run (actually it can generate anything, images included,
> but HTML is a good place to start). The server takes the output of
> your script and sends it to the requesting browser. The browser has no
> way of knowing that the HTML did not come from a static file.
>
> You can read about Python and CGI here:-
>
> http://starship.python.net/crew/davem/cgifaq/faqw.cgi?req=index
>
> There are other "linkage mechanisms" by which you can cause the
> execution of scripts on a server, e.g. mod_python, but none is
> conceptually as simple as CGI. Also, CGI tends to be more portable
> between different server software, and is almost always supported by
> hosting providers.
>
> HTH,
>
> -- 
> alan kennedy
> -----------------------------------------------------
> check http headers here: http://xhaus.com/headers
> email alan:              http://xhaus.com/mailto/alan






More information about the Python-list mailing list