[mod_python] mptest error
Roberts, Wendy
wroberts at cfa.harvard.edu
Tue Aug 4 17:13:38 UTC 2015
I'm trying to get the expected output from mptest, but am befuddled. I
currently get this:
Hello World!
> <pre>
> Mod_python error: "PythonHandler mptest"
>
> Traceback (most recent call last):
>
> File "/usr/lib64/python2.6/site-packages/mod_python/apache.py", line 398, in HandlerDispatch
> result = obj(req)
>
> File "/proj/iwebhead/www/htdocs/wtest/mptest.py", line 4, in handler
> return apache.OK
>
> NameError: global name 'apache' is not defined
>
> </pre>
>
> mod_python-3.5.0
CentOS 6.0
python 2.6
apache 2.4.12
httpd.conf (pertinent parts):
LoadModule python_module modules/mod_python.so
<Directory /proj/iwebhead/www/htdocs/wtest>
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
</Directory>
/proj/iwebhead/www/htdocs/wtest/mptest.py:
def handler(req):
req.content_type = 'text/plain'
req.write("Hello World!")
return apache.OK
Log file shows the same as the traceback:
[Tue Aug 04 12:32:08.395104 2015] [:notice] [pid 23264:tid 140389797328640]
mod_python: (Re)importing module 'mptest'
[Tue Aug 04 12:32:08.398235 2015] [:error] [pid 23264:tid 140389797328640]
[client 131.142.42.188:51119] PythonHandler mptest: Traceback (most recent
call last):
[Tue Aug 04 12:32:08.398254 2015] [:error] [pid 23264:tid 140389797328640]
[client 131.142.42.188:51119] PythonHandler mptest: File
"/usr/lib64/python2.6/site-packages/mod_python/apache.py", line 398, in
HandlerDispatch\n result = obj(req)
[Tue Aug 04 12:32:08.398265 2015] [:error] [pid 23264:tid 140389797328640]
[client 131.142.42.188:51119] PythonHandler mptest: File
"/proj/iwebhead/www/htdocs/wtest/mptest.py", line 4, in handler\n return
apache.OK
[Tue Aug 04 12:32:08.398274 2015] [:error] [pid 23264:tid 140389797328640]
[client 131.142.42.188:51119] PythonHandler mptest: NameError: global name
'apache' is not defined
Any help appreciated!
Wendy Roberts
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.modpython.org/pipermail/mod_python/attachments/20150804/f47fde6a/attachment.html>
More information about the mod_python
mailing list