1

The default Python on the server is 2.4, but Django needs version 2.5 or higher. So I installed Python 2.7 in different directory and trying to run Apache with WSGI.

Now, how do I specify for Apache/WSGI to use Python 2.7 to run the Django project?

[edit]

I can't update Python 2.4 because CentOS depends on that version of Python. Unless there is a safe way of updating without breaking a service such as yum

4
  • 2.4? Ancient RHEL? Consider updating your global python version. Commented Feb 12, 2012 at 21:47
  • 2
    dont do this on CentOS, this will break some system features. Commented Feb 12, 2012 at 21:48
  • Upgrading CentOS won't get you a less ancient version? Commented Feb 12, 2012 at 21:49
  • You may install different Python versions parallel and can do something like this in your apache conf: WSGIPythonHome /path/to/python. Have a look here, but beware, the layout of the website sometimes cuts off the content of some commands, youll be able to see them in the html source code : binarysushi.com/blog/2009/aug/19/… Commented Feb 12, 2012 at 21:53

4 Answers 4

3

You need to build mod_wsgi against python 2.7 and load this module into apache instead of the current mod_wsgi version you are using that links against python 2.4.

This requires root access to the machine.

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

Comments

0

The instructions for setting up WSGI with a virtual environment are here.

1 Comment

mod_wsgi must be compiled for a specific python version. virtualenv doesn't help with this.
0

You can run Django 1.3 in Python 2.4 without problems. I think it's the best choice for CentOS, and you won't have to upgrade Python.

I've installed django on Centos 5 with Apache+mod_wsgi and Cherokee+uwsgi (I prefer the last one)

Comments

0

"You got peanut butter on my chocolate!"

"You got chocolate in my peanut butter!"

Two great tastes that go together.

As Thiefmaster says, you need to use the correct version of wsgi. As Alex says, you need to run in a virtualenv for the later python so that you don't mess up everything else.

Install all your python stuff, including your preferred Django, into your virtualenv and everything will be good.

Comments

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.