Code


Version 4 (modified by anonymous, 3 years ago) (diff)

--

Installation

Please feel free to share the things that tripped you up when you install Django.

django-admin.py does not work

Symptom

-bash: django-admin.py: command not found

Probable cause

You don't have django-admin.py on your command search PATH.

Solution

Link <django_installation>/bin/django-admin.py to whereever on your PATH.

Note that Python on most unix-like system uses /usr/local/lib/python2.X/site-packages/ for 3rd-party packages:

sudo ln -s /usr/local/lib/python2.4/site-packages/django/bin/django-admin.py /usr/local/bin/django-admin.py

However, Python 2.6 uses {{ /usr/local/lib/python2.6/dist-packages/}} for 3rd-party packages:

sudo ln -s /usr/local/lib/python2.6/dist-packages/django/bin/django-admin.py /usr/local/bin/django-admin.py

You may get a "permission denied" message after this. Changed the permissions of the django-admin.py file to be executable.

sudo chmod +x /usr/local/bin/django-admin.py

If you've installed Python 2.6 and made it the default version, you may have to use django-admin-2.6.py startproject mysite instead.

Symptom

On unix-like system, django-admin.py says like: pkg_resources.DistributionNotFound: Django==0.91

Probable cause

You have two different versions of Django installed, and your django-admin.py does not point correct version.

Solution

Locate django-admin.py by which django-admin.py Unlink it and link correct django-admin.py from bin subdirectory of your django installation.

Database backends

Symptom

Using MySQLdb as DBI, it shows ImportError: cannot import name ImmutableSet .

Probable cause

You probably had MySQLdb 1.2.0 (or prior) installed, then override it to upgrade to 1.2.1.

MySQLdb versions prior than 1.2.0 have sets.py in MySQLdb installation. It does not contain ImmutableSet that is actually defined by built-in sets module in Python 2.4. If it left in your MySQLdb directory, it will be imported by somewhere in MySQLdb code in priority and cause ImportError.

Solution

Delete sets.py from your MySQLdb installation (only if you are sure using 1.2.1 or later).