Go down
Posts : 155
Join date : 2017-11-11
Age : 27
View user profile

httpd mod_wsgi for python3.4 not working in centos7

on Thu Dec 14, 2017 12:00 pm
I've Django application running in centos7 using python3.4. I'm using apache for webserver. BUt i'm getting following errors:

[Tue Dec 05 09:48:17.048763 2017] [:error] [pid 8470] [remote] mod_wsgi (pid=8470): Target WSGI script '/var/www/hello_world_django/hello_world_django/' cannot be loaded as Python module. [Tue Dec 05 09:48:17.049021 2017] [:error] [pid 8470] [remote] mod_wsgi (pid=8470): Exception occurred processing WSGI script '/var/www/hello_world_django/hello_world_django/'. [Tue Dec 05 09:48:17.049272 2017] [:error] [pid 8470] [remote] Traceback (most recent call last): [Tue Dec 05 09:48:17.049383 2017] [:error] [pid 8470] [remote] File "/var/www/hello_world_django/hello_world_django/", line 13, in [Tue Dec 05 09:48:17.049625 2017] [:error] [pid 8470] [remote] from django.core.wsgi import get_wsgi_application [Tue Dec 05 09:48:17.049661 2017] [:error] [pid 8470] [remote] File "/var/www/virtual/lib/python3.4/site-packages/django/", line 1, in [Tue Dec 05 09:48:17.049711 2017] [:error] [pid 8470] [remote] from django.utils.version import get_version [Tue Dec 05 09:48:17.049735 2017] [:error] [pid 8470] [remote] File "/var/www/virtual/lib/python3.4/site-packages/django/utils/", line 61, in [Tue Dec 05 09:48:17.049777 2017] [:error] [pid 8470] [remote] @functools.lru_cache() [Tue Dec 05 09:48:17.049901 2017] [:error] [pid 8470] [remote] AttributeError: 'module' object has no attribute 'lru_cache'

There seems to be some issue with mod_wsgi for python3.4. To check that i tried it with python2.7 and its working for pythyon2.7.

I'm not able to find a mod_wsgi package for python3.4 in centos. Any iseas how to fix this????

Here is my apache conf
Listen 8080
# Django settings

WSGIDaemonProcess django_com user=apache group=apache processes=1 threads=10 python-path=/var/www/sample:/var/www/sample_env/lib/python2.7/site-packages
WSGIProcessGroup django_com
WSGIScriptAlias / /var/www/sample/sample/

<Directory /var/www/sample>
    Require all granted

To get Python 3.4 working with mod_wsgi in CentOS, assuming you have Python 3.4 (and pip) installed from EPEL, you can do this:
yum install httpd-devel (you need this for the pip installation of mod_wsgi to work)
pip3 install mod-wsgi

mod_wsgi-express install-module > /etc/httpd/conf.modules.d/02-wsgi.conf
Back to top
Permissions in this forum:
You can reply to topics in this forum