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.
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.
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.
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.
精彩评论