On Sat, Dec 29, 2012 at 10:01 PM, Phil <
phi...@gmail.com> wrote:
> Is it because at the top of my "manage.py" it is pointing to my system wide
> python(#!/usr/bin/env python) instead of my virtualenv one? If so how do I
> fix this? I tried changing the path at the top of the manage.py file but
> didn't seem to do anything.
Just to answer this particular point, the way virtualenv works is by
specifying a different lib location for python libraries.
It does that by using a different python interpreter (the one in
<environ>/bin/python) - python looks relative to the binary location
for it's library files.
And it chooses a different python interpreter by putting the directory
that python interpreter is loaded from first in your $PATH environment
variable, so that it is chosen instead of your system python package
by your shell. This happens when you activate your virtualenv.
So, by activating your virtualenv, and running "python manage.py", you
are using the shell's PATH resolution to choose which 'python' binary
will be run, and it will be the one in your virtualenv.
However, even if you had run './manage.py', then the shell would look
at the shebang line, the shebang in this case points at "/usr/bin/env
python". What the env command does is to walk your $PATH environment
variable, looking for the supplied argument as a program - just like a
shell when you run a command - and so that too would have used your
virtualenv.
If you have the virtualenv activated, you can run "pip freeze" to list
all the packages that pip thinks are installed in the virtualenv. This
should give you some more information about whether django is
installed or not. You could also try uninstalling and reinstalling it,
which may fix issues if the original installation was damaged or
interrupted for some reason.
Cheers
Tom