Graham Dumpleton
grahamd at dscpl.com.au
Tue Oct 5 17:47:56 EDT 2004
On Oct 05 15:33, "Thomas Ryan" <thomas.ryan at earthlink.net> wrote: > Unfortunately, the mod_python manual doesn't bother to mention the need to > also extend PYTHONPATH. > This is probably obvious to Python experts. > > For those of you who someday google this, and who have RTFM, but are still > stuck with the "mptest module not found" import errors, try adding something > like the following to the <Directory> entry in your Apache config file: > <Directory> > .... > AddHandler mod_python .py > PythonPath "['C:/Program Files/Apache Group/Apache2/htdocs']+sys.path" > PythonHandler mptest > PythonDebug ON > </Directory> > > And stick the sample mptest.py in the htdocs directory referred to above. > > FWIW This is a Windows 2000 installation - Apache 2.0.5, mod_python 3.1.3 > For this configuration, Apache generated errors in the system event log > complaining about too many <Directory> entries. > The manual glossed over this little tidbit too, but there's a simple fix: > add the mod_python stuff after the first <Directory> tag; don't make new > ones. If the mptest.py file is placed in the directory that mod_python is enabled for, it should not be necessary to extend the Python path. If your cut and paste is accurate, the issue may be that your <Directory> specification doesn't actually mention a directory. The example in the documentation has: <Directory /some/directory/htdocs/test> AddHandler mod_python .py PythonHandler mptest PythonDebug On </Directory> See how a directory is listed inside <Directory> opening. Change your definition to (or whatever is appropriate for path defintions on Win32): <Directory C:/Program Files/Apache Group/Apache2/htdocs> .... AddHandler mod_python .py PythonHandler mptest PythonDebug ON </Directory> Alternatively, don't do it in the httpd.conf file, instead create a .htaccess file in the htdocs directory containing. AddHandler mod_python .py PythonHandler mptest PythonDebug ON -- Graham Dumpleton (grahamd at dscpl.com.au)
|