How can I change the Python that my Django project is using?

Posted by Burak on Stack Overflow See other posts from Stack Overflow or by Burak
Published on 2012-07-10T15:01:43Z Indexed on 2012/07/10 21:15 UTC
Read the original article Hit count: 245

Filed under:
|
|

I have 2 versions installed in my server. I used virtualenv to install Python 2.7.

I am using WSGI to deploy my project.

WSGIPythonPath /home/ENV/lib/python2.7/site-packages
WSGIScriptAlias / /var/www/html/my_project/wsgi.py

My http.conf is like that.

python -V gives

Python 2.7.3

But in my projects Debug window, it says Django is using 2.6.8. Where am I wrong?

UPDATE: Here is my wsgi file

import os
import sys
sys.path.append('/var/www/html')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Python Version: 2.6.8 Python Path:
['/home/ENV/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/home/ENV/lib/python2.7/site-packages/pip-1.1-py2.7.egg', '/home/ENV/lib/python2.7/site-packages/Django-1.4-py2.7.egg', '/home/ENV/lib/python2.7/site-packages', '/usr/lib/python2.6/site-packages/pip-1.1-py2.6.egg', '/usr/lib/python2.6/site-packages/django_transmeta-0.6.7-py2.6.egg', '/usr/lib/python2.6/site-packages/ipython-0.13-py2.6.egg', '/usr/lib/python2.6/site-packages/virtualenv-1.7.2-py2.6.egg', '/usr/lib64/python26.zip', '/usr/lib64/python2.6', '/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', '/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', '/usr/lib64/python2.6/site-packages', '/usr/lib64/python2.6/site-packages/gtk-2.0', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info', '/var/www/html']

In my error_log of httpd:

[Tue Jul 10 20:51:29 2012] [error] python_init: Python version mismatch, expected '2.6.7', found '2.6.8'. [Tue Jul 10 20:51:29 2012] [error] python_init: Python executable found '/usr/bin/python'. [Tue Jul 10 20:51:29 2012] [error] python_init: Python path being used '/usr/lib64/python26.zip:/usr/lib64/python2.6/:/usr/lib64/python2.6/plat-linux2:/usr/lib64/python2.6/lib-tk:/usr/lib64/python2.6/lib-old:/usr/lib64/python2.6/lib-dynload'.

© Stack Overflow or respective owner

Related posts about python

Related posts about django