2

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'.

1
  • 1
    What debug window? Are you using an IDE? If so, you need to tell us which one. Commented Jul 10, 2012 at 15:06

3 Answers 3

3

If I understand the question correctly, you are trying to configure the application's wsgi script to use a specific virtualenv.

If that is the case check out modwsgi's docs: http://code.google.com/p/modwsgi/wiki/VirtualEnvironments

I'd try to TLDR it for you, but its very well written at that link and I wouldn't be able to do it justice.

Sign up to request clarification or add additional context in comments.

Comments

1

The mod_wsgi module must be compiled for the specific Python major/minor version you want to use. You cannnot use WSGIPythonHome to force a mod_wsgi compiled against Python 2.6 to use a Python virtual environment constructed using Python 2.7.

Comments

0

If you use Buildout you can control which version of python is being used directly in the configuration file.

3 Comments

You could do what Buildout does -- just put the python that you want to use at the top of your WSGI script. Like so: #!/somepath/python/bin/python2.7
Did you restart your web server?
Sorry -- I guess I can't help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.