I have installed Python and configured in apache. I created a Python web file and open this in browser, I get an error. But the same code working in command-line. I hope the problem is from my apache configuration.
This is the error message.
MOD_PYTHON ERROR
ProcessId: 6368
Interpreter: 'localhost'
ServerName: 'localhost'
DocumentRoot: '/var/www'
URI: '/python_test/hello_world.py'
Location: None
Directory: '/var/www/'
Filename: '/var/www/python_test/hello_world.py'
PathInfo: ''
Phase: 'PythonHandler'
Handler: 'mod_python.py'
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1202, in _process_target
module = import_module(module_name, path=path)
File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 304, in import_module
return __import__(module_name, {}, {}, ['*'])
ImportError: No module named py
My Python code is :
print "Hello world!"
My httpd.conf file is :
ServerName localhost
<Directory /var/www/>
Options Indexes FollowSymlinks MultiViews
AllowOverride AuthConfig
order allow,deny
allow from all
AddHandler mod_python .py
PythonHandler mod_python.py
PythonDebug On
</Directory>