Jacob Martinson
dr.martinson at gmail.com
Fri Dec 31 00:41:09 EST 2004
I copied & paisted from the manual... root at batman:/var/www/py $ cat mptest.py from mod_python import apache def handler(req): req.write("Hello World!") return apache.OK root at batman:/var/www/py $ ls -lh mptest.py -rwxr-xr-x 1 root root 100 2004-12-30 06:10 mptest.py On Thu, 30 Dec 2004 08:57:24 -0500, Matthew Krom <mkrom at banta-im.com> wrote: > I had a similar problem yesterday -- Apache was displaying the source > of the file when I asked for it (sounds similar to your symptom). > > The cause in my case was that my py file (mptest.py in your case) did > not have a method "def handler(req):". In my case, I mis-spelled it as > "def handle(req)". > > Perhaps if mod_python cannot find a handler method, it gives up, and > Apache takes over and just serves the source file? > > Matt > > > > Hello All, > > > > I'm not a python or apache expert but have set up modpython versions 2 > > and 3 in the past with varying degrees of success... > > > > mptest.py is generating the "Hello World" message, but apache is > > sending a file named "mptest.py" with "hello world" in it, rather than > > sending it in a form where the browser will recognize it directly. > > > > Firefox, Internet Explorer and lynx will not display it directly, but > > will offer to open it with "less". Another text browser "links" opens > > it directly. > > > > Details of my system: > > > > debian linux (sarge) > > apache - 2.0.52 > > python - 2.3.4 > > modpython - 3.1.3 > > > > At the end of my apache2.conf, I have this from the install guide: > > > > <Directory /var/www/py> > > AddHandler mod_python .py > > PythonHandler mptest > > PythonDebug On > > </Directory> > > > > The module is getting loaded from a string of config file includes, > > but I'm pretty sure it is loading because I get this line in the error > > log: > > > > [Thu Dec 30 06:44:00 2004] [notice] mod_python: (Re)importing module > > 'mptest' > > > > Am I missing something? > > > > Thanks!!! > > > > -jacob > > _______________________________________________ > > Mod_python mailing list > > Mod_python at modpython.org > > http://mailman.modpython.org/mailman/listinfo/mod_python > > > >
|