I am getting this error in my apache error log file when I try to run my web.py application using mod_wsgi. I have installed web.py successfully on my shared hosting and I can confirm that I am able to import it locally:
>>> import web
>>> web.application(('/', 'test'), globals())
<web.application.application instance at 0x1f8d3b0>
I am also able to run the built in server and serve pages to my site successfully.
I can confirm that the mod_wsgi module is working in apache as well since I am able to serve pages using manual coding of a wsgi app.
I tried the suggested method for the ImportError: No module named web error message on the web.py documentation http://webpy.org/install#apachemodwsgi , i.e., adding:
abspath = os.path.dirname(__file__)
sys.path.append(abspath)
os.chdir(abspath)
import web
I also added the Files tag suggested in the http.conf file which seems redundant since I have the htdocs dir set up already, but anyway. My httpd.conf file is below, I have restarted apache and am still getting the import error message.
ServerRoot "/home/usr1/webapps/test/apache2"
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule wsgi_module modules/mod_wsgi.so
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog /home/usr1/webapps/test/logs combined
DirectoryIndex index.py
DocumentRoot /home/usr1/webapps/test/htdocs
ErrorLog /home/usr1/webapps/test/apache2/logs/error_test.log
KeepAlive Off
Listen 21708
MaxSpareThreads 3
MinSpareThreads 1
ServerLimit 1
SetEnvIf X-Forwarded-SSL on HTTPS=1
ThreadsPerChild 5
WSGIDaemonProcess test processes=5 python-path=/home/usr1/webapps/test/lib/python3.1 threads=1
WSGIProcessGroup test
WSGIRestrictEmbedded On
WSGILazyInitialization On
<Directory /home/usr1/webapps/test/htdocs>
AddHandler wsgi-script .py
</Directory>
<Files /home/usr1/webapps/test/htdocs/index.py>
SetHandler wsgi-script
Options ExecCgi FollowSymLinks
</Files>
First of all, your apache mod_wsgi seems to be compiled with python 3, that is not supported by web.py.
Your apache conf seems a lot like the one I have on Webfaction, if there is an installer for mod_wsgi with python 2.7, you have to choose it instead of python 3.
This is what my typical conf looks like:
And this is example code.py