Federer
Federer

Reputation: 34745

Point Django at different Python version

Django application requires a later version of Python. I just installed it to 2.5 (from 2.4) and now when I do a python at the command line, it says 2.5.2.

Having said that, Django still says Python Version: 2.4.3.

How do I correct this? I've rebooted / restarted / redeployed to no avail.

Upvotes: 5

Views: 6350

Answers (3)

S.Lott
S.Lott

Reputation: 391852

You have it backwards.

Django is added to Python's environment.

When you install a new Python, you must reinstall everything -- including Django -- for the new Python.

Once you have the new Django in the new Python, your PATH settings determine which Python you're using.

The version of Python (and the PYTHONPATH) determine which Django you'll use.

Upvotes: 8

Daniel Roseman
Daniel Roseman

Reputation: 599610

How are you running Django? If it's via the development server, you can explicitly choose the version of Python you're using - python2.5 manage.py runserver.

However, if you're using mod_python or mod_wsgi these are fixed to the version of Python that was used when they were compiled. If you need to change this, you'll need to recompile, or find a packaged version for your distribution that uses the updated Python.

Upvotes: 6

KevinDTimm
KevinDTimm

Reputation: 14376

django uses /usr/bin/env python IIRC.
So, wherever your path points (which python) is the python that gets used. dependent upon your system, you can point your path to the python that you want to use. However, on some OS (CentOS for example) this is a bad idea.

Upvotes: 0

Related Questions