Executing a python script from an HTML link?

John Roth newsgroups at jhrothjr.com
Tue Sep 23 14:03:27 EDT 2003


"Andrew Chalk" <achalk at XXXmagnacartasoftware.com> wrote in message
news:1t%bb.407$Q44.601209120 at newssvr11.news.prodigy.com...
> Thanks. I want to run the script on the server. 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?
> Regards.

That's not a Python issue. It's a web server configuration
issue. You should be able to configure your web server
to recognize href="fred.py" as a request to run the fred.py
script using the Python interpreter, and pass back whatever
web page, graphic or other file it outputs. For that matter,
you might even be able to configure it to recognize
"Fred.htm" as a python script, and rewrite the name
to "fred.py."

John Roth
>
>
> "John Roth" <newsgroups at jhrothjr.com> wrote in message
> news:vn0tdkg96jlcc7 at news.supernews.com...
> >
> > "Andrew Chalk" <achalk at XXXmagnacartasoftware.com> wrote in message
> > news:tMYbb.382$zy3.566196578 at newssvr11.news.prodigy.com...
> > > Is this possible? In my CGI app. I display a web page with a link
> > (anchor).
> > > When the link is clicked I want to exectute a python script rather
than
> go
> > > to an HTML page.
> >
> > Do you want to run the script on the server or the client? If you
> > want to run it on the client, you can use Python instead of Javascript
> > (or in addition to Javascript) in the web page. Look at the <script>
> > tag for the language (I think that's the one - I haven't looked it up
> > recently) attribute. Otherwise, just invoke Python the same way you
would
> > invoke any other executable, and use the script name as the
> > first parameter.
> >
> > John Roth
> >
> > >
> > > Many thanks.
> > >
> > >
> >
> >
>
>






More information about the Python-list mailing list