Houman
Houman

Reputation: 66320

Upgrading Django to 1.4.1

According to the documentation, if Django was installed manually like python setup.py install then the directory needs to be deleted manually.

I found out where Django was installed by running this from Shell

python -c "import sys; sys.path = sys.path[1:]; import django; print(django.__path__)"

and deleted django directory from /usr/local/lib/python2.7/dist-packages/django

Thereafter I tried to install 1.4.1 the automatic way:

sudo pip install Django

Surprisingly it refused to install it:

Requirement already satisfied (use --upgrade to upgrade): Django in /usr/local/lib/python2.7/dist-packages
Cleaning up...

So I had no choice than doing this, even though the documentation hasn't reflect that.

sudo pip install Django --upgrade

Log:

Downloading/unpacking Django
  Downloading Django-1.4.1.tar.gz (7.7Mb): 7.7Mb downloaded
  Running setup.py egg_info for package Django

Installing collected packages: Django
  Found existing installation: Django 1.4
    Uninstalling Django:
      Successfully uninstalled Django
  Running setup.py install for Django
    changing mode of build/scripts-2.7/django-admin.py from 644 to 755

    changing mode of /usr/local/bin/django-admin.py to 755
Successfully installed Django
Cleaning up...

It seems the documentation hasn't mentioned that django files aren't just in /python2.7/dist-packages/django but also in /usr/local/bin/django-admin.py

I wonder if this is correct the way I have done it, since the documentation explicitely warns:

If you use this installation technique, it is particularly important that you remove any existing installations of Django first. Otherwise, you can end up with a broken installation that includes files from previous versions that have since been removed from Django.

Upvotes: 2

Views: 842

Answers (2)

Mike O'Connor
Mike O'Connor

Reputation: 1

I am going through this kind of confusion, caused by the inadequate language in the Django docs concerning how to install Django. Note that they do say that if you had used python setup.py then you must remove, manually, the Django stuff from "site-packages"--- not from "dist-packages" as Kave did.

You can evidently just manually install Django by dragging it into site-packages (if you don't already have it installed by PIP or EasyInstall).

They say that if you had used PIP or EasyInstall then you can let those programs handle the removal for you. That could mean that you dare not do manual removal in that case, for the reason that Kave suggested.

Would that someone with Django were willing to write as if words had precise meanings.

I can't go back and experiment with installing 1.4 now over a previous version, as 1.4 is the version that I started with. But Kave, perhaps you, like me, didn't remember exactly how you installed the previous version. You might have used EasyInstall or even PIP back then, thus causing the Django folder to be placed in dist-packages instead of site-packages.

I found an "egg" info file in the dist-packages folder with my old Django version. EasyInstall uses eggs; a brief look at setup.py docs suggests that it doesn't.

Upvotes: 0

Thomas Schwärzl
Thomas Schwärzl

Reputation: 9917

everything ok.

Normaly there's only a symlink in /usr/local/bin.

Upvotes: 1

Related Questions