Why does a Web browser running under Linux show Python CGI scripts as plain text?!

Andrew McGregor andrew at indranet.co.nz
Mon Feb 3 19:29:59 EST 2003



--On Monday, February 03, 2003 13:16:27 -0800 Zorba 
<ghostagain at operamail.com> wrote:

> I have also posted this on the comp.os.linux.help newsgroup, where it
> may be more appropriate.
>
> I just installed SuSE Linux 8.1 a few days ago--my first experience
> with
> Linux ever. I am slowly sorting out problems.
>
> One big problem: I have a Web site (which I coded using Windows) at
> http://usable-thought.com which has some CGI pages coded using Python,
> to produce dynamically rendered HTML (they are the Marketing Tips
> pages, if you want to take a look). These work fine when I'm browsing
> in any browser on my Win98 desktop--but when I use any browser in
> Linux (Opera, Konquerer, Netscape 7.0, doesn't matter), the pages are
> displayed as plain text--in other words, I am shown the underlying
> Python script.

Your Windows machine has python installed, no?  So, the python is being run 
client side, not in the server.  Linux doesn't do this (sensibly, as it's a 
huge security problem).  Your Linux web server is not running the CGIs, 
probably because either the permissions on the files are not right or the 
server is not configured to run CGIs in whichever directory you have them.

What you need to do is to look into the documentation of your web server to 
find out what you need to do to the permissions on the .py files and the 
configuration of the server to make the cgis run there.  If you tell me 
which server it is and how you have it configured, I can try to help 
off-list.

> I tried to tell Opera to view .py scripts as text/html, but this did
> not fix the problem. Not sure what else to do, since the situation
> makes no sense to me. I would have thought Web browsing should be as
> independent as possible from the client OS--but apparently I am wrong,
> at least when it comes to Linux.

It's the behaviour of your Windows browsers and web server that's a little 
strange.

> Can anybody tell me why this is happening, and what the cure is? I
> can't believe that every Pythonista running Linux on their desktop is
> unable to view CGI pages coded in Python - the whole thing is either
> laughable or mind-boggling, an open-source nightmare.

Windows made your problem, but it's fairly easy to fix.

Andrew

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030204/12c5b632/attachment.sig>


More information about the Python-list mailing list