bash: django-admin.py: command not found

2,539 views
Skip to first unread message

ErritG

unread,
Nov 15, 2010, 8:44:35 AM11/15/10
to Django users
Hi Everybody,

Been struggling with the first part of the Tutorial. Even though the
'bash: django-admin.py: command not found' has been solved by others I
can't seem to get around this error. Perhaps it's because I'm using
version 2.7 while all the found solutions mention up to 2.6 as
version?

Can anyone guide me to the first part of the tutorial based on version
2.7? Thanks in advance for your help!

Have a good one,

Errit.

Marc Aymerich

unread,
Nov 15, 2010, 9:57:50 AM11/15/10
to django...@googlegroups.com

Seems that your shell doesn't know where django-admin.py is. In what
directory you have installed django?

You can solve this problem by making a symbolic link like this:

ln -s "$DJANGO-INSTALLED-PATH"/django/bin/django-admin.py /usr/bin/

--
Marc

Shawn Milochik

unread,
Nov 15, 2010, 10:05:26 AM11/15/10
to django...@googlegroups.com
The version of Python isn't related to this. The problem is that the
django script you are calling isn't on your system's PATH.

If a program is on your PATH, such as the 'ls' command, you can just
type 'ls' and it will run. If you type 'which ls' you will see where
the program lives. You can also run it with the full path, for example
"/bin/ls."

Since your django-admin.py isn't on your PATH, you will either have to
add it or run it by passing the full path.

Example:

If django-admin.py lives here: /usr/local/bin/django-admin.py

You can either:

export PATH=$PATH:/usr/local/bin

or:

python /usr/local/bin/django-admin.py

Shawn

Tom Evans

unread,
Nov 15, 2010, 10:05:50 AM11/15/10
to django...@googlegroups.com
On Mon, Nov 15, 2010 at 2:57 PM, Marc Aymerich <glic...@gmail.com> wrote:
> Seems that your shell doesn't know where django-admin.py is. In what
> directory you have installed django?
>
> You can solve this problem by making a symbolic link like this:
>
> ln -s "$DJANGO-INSTALLED-PATH"/django/bin/django-admin.py /usr/bin/
>
> --
> Marc
>

You should never do that. Either install it globally, so that it is
installed like that anyway, or install per user, and configure your
shell correctly so that it can find the appropriate apps.

Doing half of each is a maintenance disaster.

One can even use virtualenv to make this process easier.
apt-get/yum/portinstall/emerge virtualenv, and then simply:

mkdir project; cd project ; virtualenv env ; source env/bin/activate ;
pip install django


Cheers

Tom

Tom Evans

unread,
Nov 15, 2010, 9:59:00 AM11/15/10
to django...@googlegroups.com

This has nothing to do with python 2.7

The prefix where you installed django is not in your $PATH environment
variable. Either you installed it globally in the wrong place, or you
installed it locally for your user, and need to add that prefix to
your path - similar to the changes you would have had to make to get
python to find django as well.

Eg if you installed in ~/my-python-packages, then django-admin.py is
in ~/my-python-packages/bin/ , and that location must be added to your
PATH.

Cheers

Tom

Reply all
Reply to author
Forward
0 new messages