a little more help with python server-side scripting

Paul Boddie paul at boddie.org.uk
Thu Feb 23 18:43:39 EST 2006


John Salerno wrote:
> Paul Boddie wrote:
>
> > No, it means that you either write Python programs which produce pages
> > as output, according to the CGI specification, or that you embed Python
> > code inside ASP files, as described in the above document.
>
> > I haven't used ASP, and I've been working hard to remove from my memory
> > any trace of similar systems (eg. JSP), but I imagine that if you want
> > to include normal Python programs inside ASP files, there may be a way
> > of using some kind of "include" directive. Take a look at the above
> > document for some ideas.
>
> Why do you mention ASP though? Can't this be done without it?

You mean, can't you just write normal HTML files, add some kind of
"include" directive, call them something ending in .html, and then have
the server produce a combination of normal HTML and the output from
Python code? Well, not really, since that (apart from the .html
extension on the filename) is a description of what ASP is about, more
or less.

But yes, if you want to run Python code without doing strange things
with ASP files, then just write a program (not a Web page, but an
actual Python program) as described in the Microsoft document (or
virtually any introduction to CGI with Python), upload it into the
appropriate folder/directory with a filename ending in .py and test it
out! See this recipe for other examples (found using the search text
"CGI Python" with Google):

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52220

Paul




More information about the Python-list mailing list