1

I'm trying to compile mod_wsgi (version 3.2) against python 2.7.5. I am trying to run Django as a wsgi application using apache in a amazon linux image which comes with python 2.6.9 by default. What are the steps to compile mod_wsgi against python 2.7.5 instead of 2.6.9 as seen in the log.I have installed python 2.7.5 !

But I get the following error:

> [Mon Feb 16 03:59:30 2015] [notice] Apache/2.2.29 (Unix) mod_wsgi/3.2
> Python/2.6.9 DAV/2 PHP/5.3.29 mod_ssl/2.2.29 OpenSSL/1.0.1k-fips
> mod_perl/2.0.7 Perl/v5.16.3 configured -- resuming normal operations
> [Mon Feb 16 03:59:39 2015] [error] [client 73.222.21.30] mod_wsgi
> (pid=24542): Target WSGI script
> '/var/www/djangocode/DevOpsAccelerator/DevOpsAccelerator/wsgi.py'
> cannot be loaded as Python module. [Mon Feb 16 03:59:39 2015] [error]
> [client 73.222.21.30] mod_wsgi (pid=24542): Exception occurred
> processing WSGI script
> '/var/www/djangocode/DevOpsAccelerator/DevOpsAccelerator/wsgi.py'.
> [Mon Feb 16 03:59:39 2015] [error] [client 73.222.21.30] Traceback
> (most recent call last): [Mon Feb 16 03:59:39 2015] [error] [client
> 73.222.21.30]   File "/var/www/djangocode/DevOpsAccelerator/DevOpsAccelerator/wsgi.py",
> line 13, in <module> [Mon Feb 16 03:59:39 2015] [error] [client
> 73.222.21.30]     from django.core.wsgi import get_wsgi_application [Mon Feb 16 03:59:39 2015] [error] [client 73.222.21.30]   File
> "/usr/lib/python2.6/site-packages/django/core/wsgi.py", line 2, in
> <module> [Mon Feb 16 03:59:39 2015] [error] [client 73.222.21.30]    
> from django.core.handlers.wsgi import WSGIHandler [Mon Feb 16 03:59:39
> 2015] [error] [client 73.222.21.30]   File
> "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line
> 11, in <module> [Mon Feb 16 03:59:39 2015] [error] [client
> 73.222.21.30]     from django import http [Mon Feb 16 03:59:39 2015] [error] [client 73.222.21.30]   File
> "/usr/lib/python2.6/site-packages/django/http/__init__.py", line 2, in
> <module> [Mon Feb 16 03:59:39 2015] [error] [client 73.222.21.30]    
> from django.http.request import (HttpRequest, QueryDict, [Mon Feb 16
> 03:59:39 2015] [error] [client 73.222.21.30]   File
> "/usr/lib/python2.6/site-packages/django/http/request.py", line 11, in
> <module> [Mon Feb 16 03:59:39 2015] [error] [client 73.222.21.30]    
> from django.conf import settings [Mon Feb 16 03:59:39 2015] [error]
> [client 73.222.21.30]   File
> "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 9, in
> <module> [Mon Feb 16 03:59:39 2015] [error] [client 73.222.21.30]    
> import importlib [Mon Feb 16 03:59:39 2015] [error] [client
> 73.222.21.30] ImportError: No module named importlib [Mon Feb 16 06:52:02 2015] [notice] caught SIGTERM, shutting down
rnevius
  • 26,578
  • 10
  • 58
  • 86
Rohan S
  • 223
  • 1
  • 2
  • 10
  • possible duplicate of [Django / Apache / mod\_wsgi: No module named importlib](http://stackoverflow.com/questions/11492683/django-apache-mod-wsgi-no-module-named-importlib) – rnevius Feb 16 '15 at 07:19
  • 1
    I did come across this post, it did not say how to fix the error. Finally found the solution in this [https://gist.github.com/havencruise/8307140] (https://gist.github.com/havencruise/8307140) to reinstall mod_wsgi and configuring it to use python2.7 – Rohan S Feb 16 '15 at 17:53

0 Answers0