[mod_python] Python scripts are showing source code

Graham Dumpleton graham.dumpleton at gmail.com
Tue Apr 15 01:48:52 EDT 2008


2008/4/15 Nick Le Mouton <noodles at planetslackers.com>:
> I've been reading that page and followed it to the letter apart from adding
>  the PythonHandler and PythonDebug.
>
>  I don't really see how I'd need either of these to run a single script.

Basic mod_python handlers are not resource based like CGI. You
actually have to tell mod_python the name of a Python module
containing a content handler to execute. Thus PythonHandler directive
is very important. PythonDebug is useful because if something goes
wrong the error will show in the browser rather than you having to dig
through the Apache error logs to find it.

Thus, perhaps rather than make assumptions just follow the
instructions and get something working first to verify mod_python
works.

The closest thing then to the CGI resource model is to use
mod_python.publisher as PythonHandler. You then should however refer
to parts of mod_python documentation which talk about
mod_python.publisher as how you code the handler and other stuff in
the file is different.

Graham

>  Nick
>
>
>
>  -----Original Message-----
>  From: Graham Dumpleton [mailto:graham.dumpleton at gmail.com]
>  Sent: Tuesday, 15 April 2008 4:03 p.m.
>  To: Nick Le Mouton
>  Cc: mod_python at modpython.org
>  Subject: Re: [mod_python] Python scripts are showing source code
>
>  Try reading:
>
>   http://www.dscpl.com.au/wiki/ModPython/Articles/GettingModPythonWorking
>
>  Graham
>
>  2008/4/15 Nick Le Mouton <noodles at planetslackers.com>:
>  > Hi all,
>  >
>  >  I'm new to python and mod_python and I'm trying to get a script to work
>  on
>  >  my install of Apache.
>  >
>  >  I've installed mod_python and I can see that it's installed in the
>  >  error_log:
>  >
>  >  [Tue Apr 15 13:26:44 2008] [notice] Apache/2.2.8 (Unix) mod_ssl/2.2.8
>  >  OpenSSL/0.9.7a PHP/5.2.5 mod_python/3.3.1 Python/2.3.4 configured --
>  >  resuming normal operations
>  >
>  >  I have added LoadModule python_module modules/mod_python.so in httpd.conf
>  >
>  >  As well as AddHandler mod_python .py
>  >
>  >  The script I'm trying to run is in the cgi-bin for apache,
>  >  /usr/local/apache2/cgi-bin/, this is also setup with ScriptAlias as per
>  the
>  >  default httpd.conf.
>  >
>  >  I'm running Apache 2.2.8 on Redhat Enterprise Linux 4. Apache is
>  installed
>  >  from source, python and python-devel from rpm.
>  >
>  >  No matter what I do I still see the source code of the py file rather
>  than
>  >  it running.
>  >
>  >  Can anyone help?
>  >  Thanks
>  >  Nick
>  >
>  >  _______________________________________________
>  >  Mod_python mailing list
>  >  Mod_python at modpython.org
>  >  http://mailman.modpython.org/mailman/listinfo/mod_python
>  >
>
>
>


More information about the Mod_python mailing list