0

I am using Python 2.7 with mod_python 3.3.1 and mod_wsgi 3.3.

I get an Internal Server Error and this stack trace in the apache logs:

[Thu Apr 21 10:25:37 2011] [error] [client 83.244.243.242]     import django.core.handlers.wsgi [Thu Apr 21 10:25:37 2011] [error] [client
83.244.243.242] ImportError: No module named django.core.handlers.wsgi [Thu Apr 21 10:25:37 2011] [error] [client
83.244.243.242] mod_wsgi (pid=4463): Target WSGI script '/home/one/codebase/campman/wsgi_handler.py' cannot be loaded as Python module. [Thu Apr 21 10:25:37 2011] [error] [client 83.244.243.242] mod_wsgi (pid=4463): Exception occurred processing WSGI script '/home/one/codebase/campman/wsgi_handler.py'. [Thu Apr 21 10:25:37 2011] [error] [client 83.244.243.242] Traceback (most recent call last): [Thu Apr 21 10:25:37 2011] [error] [client
83.244.243.242]   File "/home/one/codebase/campman/wsgi_handler.py", line 13, in <module> [Thu Apr 21 10:25:37 2011] [error] [client
83.244.243.242]     import django.core.handlers.wsgi [Thu Apr 21 10:25:37 2011] [error] [client
83.244.243.242] ImportError: No module named django.core.handlers.wsgi
1
  • 1
    How about posting the contents of wsgi_handler.py? Aug 26, 2012 at 17:11

3 Answers 3

1

You may need to tell your WSGI handler where to look for site-packages:

import site
site.addsitedir('/path/to/lib/python2.7/site-packages')
0

Sounds like whatever software you are trying to host depends on and needs you to install django or some of it's supporting modules for apache. Look into installing these through your distro's package manager.

2
  • I think the problem is that I have installed Python 2.7 and the mod_wsgi is looking at Python2.5 site-packages. Is there some way I can change this?
    – bigmac
    Apr 21, 2011 at 10:40
  • 1
    Upgrade mod_wsgi to a version that knows what to do with Python 2.7. If you upgrade all the packages in your distribution, this shouldn't happen. If you have manually installed python without using your distros packages, you might have to do the same for everything that depends on it.
    – Caleb
    Apr 21, 2011 at 10:59
0

Look at the WSGIPythonExecutable and WSGIPythonPath apache directives.

Be aware that mod_python and mod_wsgi are mutually exclusive.

1
  • 1
    WSGIPythonExecutable doesn't exist in latest mod_wsgi versions. And mod_python and mod_wsgi are not mutually exclusive if set up right. Mar 16, 2012 at 15:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .