[mod_python] Problems with mod_python

Graham Dumpleton graham.dumpleton at gmail.com
Wed Jan 23 19:40:32 EST 2008


On 24/01/2008, Martha Zimet <zimet at manray.com> wrote:
> I got it working.. It was something weird. apapchectl restart did not
> seem to reread the httpd.conf file even though it acted like it did
> when I specified the -t option, When I did a apachectl stop and then
> apapchectl start it suddenly started to work.

Progress at least. :-)

> Now, I am getting this error:
>
> Mod_python error: "PythonHandler mptest"
>
> Traceback (most recent call last):
>
>   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 287, in
> HandlerDispatch
>     log=debug)
>
>   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 454, in
> import_module
>     f, p, d = imp.find_module(parts[i], path)
>
> ImportError: No module named mptest
>
> where mptest is the Python program I have specified as the handler.
> I am assuming that I need to do something with the PythonPath directive.
> Is that correct?

The directory context that the PythonHandler directive is specified in
should be automatically added to Python sys.path unless you have
already specified the PythonPath directive at some scope which
overrides that and thus disables the automatic addition of the path.

So, at the moment are you using main Apache configuration or .htaccess
for setting up PythonHandler directive? Can you show the latest
Directory configuration snippet and .htaccess files?

PS, please keep the discussion on the list. That way it is archived
and others can learn from it.

Graham

> Thanks again.
>
> Regards,
>
> /martha
>
> On Thu Jan 24 10:23 , 'Graham Dumpleton' <graham.dumpleton at gmail.com> sent:
>
> >The only other suggestion is to check the file permissions of the
> >.htaccess file. It must be readable to Apache user. Thus maybe you
> >need:
> >
> >  chmod 0644 .htaccess
> >
> >Graham
> >
> >On 24/01/2008, Martha Zimet zimet at manray.com> wrote:
> >> This is what *exactly* I have in my httpd.conf file in the
> >> Directory section after the Directory specification for the
> >> server root directory:
> >>
> >>
> >>     AllowOverride FileInfo
> >>
> >>
> >> I have tried many permutations, with and without double quotes,
> >> specifying All instead of FileInfo, trying different directory names, etc.
> >> No matter what I do, the .htaccess file is not being read at all.
> >>
> >> Thanks for all your help and I am sorry to be a bother.
> >>
> >> Regards,
> >>
> >> /martha
> >>
> >> On Thu Jan 24  9:31 , 'Graham Dumpleton' graham.dumpleton at gmail.com> sent:
> >>
> >> >Just make sure you don't have multiple AllowOverride lines in the same
> >> >Directory context block as from memory they aren't cumulative. Thus a
> >> >later one will wipe out settings from an earlier one.
> >> >
> >> >Graham
> >> >
> >> >On 24/01/2008, Martha Zimet zimet at manray.com> wrote:
> >> >> It looks like .htacess is not being read and and I entered
> >> >> the AllowOverride FileInfo directive as you suggested. The
> >> >> directives were entered in the Directory section of httpd.conf.
> >> >>
> >> >> I will keep trying..
> >> >>
> >> >> Regards,
> >> >>
> >> >> /martha
> >> >>
> >> >> On Thu Jan 24  8:55 , "Graham Dumpleton"  sent:
> >> >>
> >> >> >For the .htaccess method did you validate that the .htaccess file was
> >> >> >actually being used by Apache? The easiest way to do this is to add
> >> >> >some crap in it to trigger a syntax error. This should cause a 500
> >> >> >error response to come back. So, add into your .htaccess file:
> >> >> >
> >> >> >  XXXX Some Crap XXXX
> >> >> >
> >> >> >If you don't get a 500 error, then you likely don't have FileInfo
> >> >> >override specified for that directory and so Apache is ignoring the
> >> >> >file.
> >> >> >
> >> >> >Graham
> >> >> >
> >> >> >On 24/01/2008, Martha Zimet zimet at manray.com> wrote:
> >> >> >> I am running Linux, kernel 2.6.22.
> >> >> >>
> >> >> >> I have tried the configuration methods using .htaccess and
> >> >> >> httpd.conf. I have tried using the complete path name
> >> >> >> in httpd.conf (the physical directory) as well. Your
> >> >> >> desscription in the first URL you sent was quite good.
> >> >> >>
> >> >> >> Regards,
> >> >> >>
> >> >> >> /martha
> >> >> >>
> >> >> >> On Thu Jan 24  7:24 , "Graham Dumpleton"  sent:
> >> >> >>
> >> >> >> >On 24/01/2008, Martha Zimet zimet at manray.com> wrote:
> >> >> >> >> I have followed your nstructions and I am still running into
> >> >> >> >> the same problem, that is, only the source displays. I am running
> >> >> >> >> mod_pyton version 3.1 have verified that is is indeed loaded
> >> >> >> >> by checking the httpd error log per the document you referred
> >> >> >> >> me to.
> >> >> >> >
> >> >> >> >Did you try the .htaccess method in those instructions rather than
> >> >> >> >trying to do it in your main Apache configuration file?
> >> >> >> >
> >> >> >> >What operating system are you using?
> >> >> >> >
> >> >> >> >> Any more suggestions? My configuration file has the following:
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >Is this what you have for real?
> >> >> >> >
> >> >> >> >The argument to the Directory directive is meant to be an actual
> >> >> >> >physical directory, not a URL path component.
> >> >> >> >
> >> >> >> >Graham
> >> >> >> >
> >> >> >> >>     AddHandler mod_python .py
> >> >> >> >>     PythonHandler mptest
> >> >> >> >>     PythonDebug On
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> I have tried it also with a /test directory with the same result.
> >> >> >> >> Any light you can shed would be greatly appreciated.
> >> >> >> >>
> >> >> >> >> Regards,
> >> >> >> >>
> >> >> >> >> /martha
> >> >> >> >>
> >> >> >> >> On Thu Jan 24  6:30 , "Graham Dumpleton"  sent:
> >> >> >> >>
> >> >> >> >> >Try following procedure documented in:
> >> >> >> >> >
> >> >> >> >> >
> http://www.dscpl.com.au/wiki/ModPython/Articles/GettingModPythonWorking
> >> >> >> >> >
> >> >> >> >> >Do all the checks it talks about to make sure things are configured
> >> correctly.
> >> >> >> >> >
> >> >> >> >> >Graham
> >> >> >> >> >
> >> >> >> >> >On 24/01/2008, Martha Zimet zimet at manray.com> wrote:
> >> >> >> >> >> I am having problems getting mod_python to work correctly.
> >> >> >> >> >> I am following the directions in
> >> >> >> >> >>
> http://www.modpython.org/live/mod_python-3.2.8/doc-html/inst-testing.html
> >> >> >> >> >> and have written a mptest.py. However, when I access mptest.py from my
> >> >> browser,
> >> >> >> >> >> the code does not execute and all I get is the text for mptest.py
> >> >> >> >> >> displaying in the browser window. For example:
> >> >> >> >> >>
> >> >> >> >> >> from mod_python import apache
> >> >> >> >> >>
> >> >> >> >> >> def handler(req):
> >> >> >> >> >>     req.content_type = 'text/plain'
> >> >> >> >> >>     req.write("Hello World!")
> >> >> >> >> >>     return apache.OK
> >> >> >> >> >>
> >> >> >> >> >> Does anyone have any suggestions on what could be wrong with my
> >> installation
> >> >> >> >> >> or how I can further diagnose this problem? Thanks in advance and I
> >> >> apologize
> >> >> >> >> >> if this situation has been answered before.
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> _______________________________________________
> >> >> >> >> >> 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