Target WSGI script cannot be loaded as Python module
For me the problem was wsgi python version mismatch. I was using python 3, so:
$ sudo apt-get remove libapache2-mod-python libapache2-mod-wsgi$ sudo apt-get install libapache2-mod-wsgi-py3
Warning from @alxs before you copy/paste these commands:
If there are python 2 projects running on the server that use wsgi and apache, the above commands will effectively shut them down.
I had a similar problem with this error message in the logs:
Target WSGI script '/home/web2py/wsgihandler.py' cannot be loaded as Python module.
The solution was the deletion of an incorrect WSGIPythonHome directive (pointing to the application directory) from /etc/httpd/conf.d/wsgi.conf
I'm on RedHat using CentOS repositories.
Recommend following Graham Dumpleton's installation/configuration instructions. Testing configuration against the helloworld application showed me that mod_wsgi
was working and the configuration was at fault.
However, the error message gave little clue as to what was wrong.