Mod-wsgi is using the wrong python version

I am trying to set up a Django site using Apache and mod WSGI. When I open some pages on the admin site, I get the error

'ascii' codec cannot encode characters in position 0-7: ordinal not in Range (128)

More details about the error:

Django Version:     1.7.1
Exception Type:     UnicodeEncodeError
Exception Value: 'ascii' codec can't encode characters in position 0-7: ordinal not in range(128)
Exception Location:     /var/www/.virtualenvs/tankienv/lib/python3.4/site-packages/django/utils/encoding.py in force_text, line 87
Python Executable:  /usr/bin/python

      

It seems that mod-wsgi is using python 2.7 instead of python 3. How do I solve this?

When I try to add the path to patch the python executable in apache2.conf

WSGIPythonHome /var/www/.virtualenvs/myprojectenv/bin

      

the site stops responding.

+3


source to share


1 answer


The python3 version of mod-wsgi must be installed.

I ran these commands to fix it on my Ubuntu 13.04



sudo apt-get remove libapache2-mod-wsgi
sudo apt-get install libapache2-mod-wsgi-py3 

      

+4


source







All Articles