Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an Arch Linux server that used to use Python 2.7.3 just fine with Apache and mod_wsgi-3.4-2. I have both Python 2.7.3 and 3.3.0 installed on the server, and both executables are located in /usr/bin. Recently it has started to use Python 3. I need Apache to go back to using Python 2.7. The error_log looks something like this on a single request:

[Thu Dec 13 00:18:50 2012] [notice] Apache/2.2.23 (Unix) mod_wsgi/3.4 Python/3.3.0 mod_ssl/2.2.23 OpenSSL/1.0.1c DAV/2 PHP/5.4.9 configured -- resuming normal operations
[Thu Dec 13 00:18:53 2012] [error] 3.3.0 (default, Sep 29 2012, 16:08:02) 
[Thu Dec 13 00:18:53 2012] [error] [GCC 4.7.1 20120721 (prerelease)]
[Thu Dec 13 00:18:53 2012] [error] 
[Thu Dec 13 00:18:53 2012] [error] [client] mod_wsgi (pid=6156): Target WSGI script '/path/to/webapp/apache/' cannot be loaded as Python module.
[Thu Dec 13 00:18:53 2012] [error] [client] mod_wsgi (pid=6156): Exception occurred processing WSGI script '/path/to/webapp/apache/'.
[Thu Dec 13 00:18:53 2012] [error] [client] Traceback (most recent call last):
[Thu Dec 13 00:18:53 2012] [error] [client]   File "/path/to/webapp/apache/", line 4, in <module>
[Thu Dec 13 00:18:53 2012] [error] [client]     from django.core.handlers import wsgi
[Thu Dec 13 00:18:53 2012] [error] [client] ImportError: No module named 'django'

Here's my file:

import os
import sys
from django.core.handlers import wsgi

site_path = '/path/to/webapp/csis3150site'
if site_path not in sys.path:

os.environ['DJANGO_SETTINGS_MODULE'] = 'csis3150site.settings'

# start wsgi
application = wsgi.WSGIHandler()

This is the mod_wsgi-related configuration from httpd.conf:

LoadModule wsgi_module modules/
WSGIScriptAlias / /path/to/webapp/apache/ 
WSGIPythonPath /path/to/webapp
share|improve this question
up vote 0 down vote accepted

I was able to fix this be uninstalling the mod_wsgi package and replaced it with the mod_wsgi2 package.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.