a little more help with python server-side scripting

Paul Boddie paul at boddie.org.uk
Thu Feb 23 16:13:34 EST 2006


John Salerno wrote:
> John Salerno wrote:
>
> > Unfortunately, I don't completely understand what it is I need to do
> > now. Where do I put the path they mentioned? And what do they mean by my
> > script path?
>
> Ok, seems like the verdict is that the server doesn't have mod_python
> nor does it detect the .psp extension. It can, however, detect the .py
> extension.

>From what I understand of the situation, noting that I haven't used IIS
with Python at all as far as I remember (and it'd be about six or seven
years ago if I did), you're using Windows hosting where .py files get
special treatment - ie. they don't get served up as text files but are
executed somehow - and that this is probably configured by your
provider as described in this document (found via Google using the
search text "IIS Python"):

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B276494

> But does this mean I can simply include Python code in my
> HTML files, and then give my HTML files a .py extension?

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 don't know how to test this because I don't know how to write inline code yet. Is
> it something like:
>
> <%@ include file=something %>

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.

> ? They say:
>
> "Please note that you may map .py to .html extension. However, if you
> set this mapping, .html will not work with the normal html tags anymore."
>
> But I don't know what this means about 'mapping' the extension and what
> it means that html tags won't work anymore.

I think they're just trying to say that if you decide that your Python
programs should have a .html extension and still be executed as Python
programs, don't expect the server to serve up HTML pages any more.

Paul




More information about the Python-list mailing list