mardi 12 août 2014

python - django-admin.py : commande introuvable (bluehost serveur) - Stack Overflow


After struggling more than 6 hours, I decided to ask for help.


Mission: To create a project with the help of Django
Tools: Windows Vista, Putty SSH
Location: Bluehost (www.bluehost.com) Server


I have already read these topics about the same question:



  1. -bash: django-admin.py: command not found (Django Installation)

  2. Unable to use django-admin.py

  3. Django: When creating a new project, “django-admin.py: command not found” Error pops up

  4. django-admin.py: command not found

  5. Command not found: django-admin.py

  6. Django-admin.py not working (-bash:django-admin.py: command not found)


I have installed Python as explained here (Bluehost Help Page):
https://my.bluehost.com/cgi/help/python-install


Python 2.7.2 installed and checked, and it looks like:


username@domain.com [~/python]# ls
./ ../ Python-2.7.2/ Python-2.7.2.tgz bin/ include/ lib/ share/

the directory ~/python/Python-2.7.2/ looks like this:


username@domain.com [~/python/Python-2.7.2]# ls
./ LICENSE Objects/ build/ pyconfig.h.in
../ Lib/ PC/ config.log python*
.hg_archival.txt Mac/ PCbuild/ config.status* python-gdb.py
.hgtags Makefile Parser/ configure* setup.py
Demo/ Makefile.pre Python/ configure.in
Doc/ Makefile.pre.in README install-sh*
Grammar/ Misc/ RISCOS/ libpython2.7.a
Include/ Modules/ Tools/ pyconfig.h

and ~/python/bin/ looks like this:


username@domain.com [~/python/bin]# ls
./ 2to3* idle* python* python2.7* smtpd.py*
../ django-admin.py* pydoc* python-config@ python2.7-config*

Django 1.5 installed and checked, and it looks like:


username@domain.com [~/Django-1.5]# ls
./ AUTHORS LICENSE PKG-INFO build/ docs/ scripts/ setup.py
../ INSTALL MANIFEST.in README.rst django/ extras/ setup.cfg tests/

and ~/Django-1.5/bin/ looks like this:


username@domain.com [~/Django-1.5/django/bin]# ls
./ __init__.py django-2to3.py* profiling/
../ daily_cleanup.py* django-admin.py* unique-messages.py*

Problem: When I try to create my project, I see this error:


username@domain.com [~/www/domain/]# django-admin.py startproject mysite
-bash: django-admin.py: command not found

Then I have tried again without .py, I see this error:


username@domain.com [~/www/domain/]# django-admin.py startproject mysite
-bash: django-admin.py: command not found

~/.bashrc looks like this:


# .bashrc
export PATH=$HOME/.local/bin:$HOME/.local/usr/bin:$PATH

#User specific aliases and functions


alias mv='mv -i'
alias rm='rm -i'
alias cp='cp -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
~
~

~/bin/ looks like this:


username@domain.com [~/bin]# ls
./ ../

So I read a lot about the PATH, but I could not make it work. Should I give up?




Modify your .bashrc PATH entry to look like:


export PATH=$HOME/Django-1.5/bin/:$HOME/.local/bin:$HOME/.local/usr/bin:$PATH

And reload your .bashrc by doing:


# . ~/.bashrc



Add django path to your $PATH.


Change you ~/.bashrc to


# .bashrc
export PATH=$HOME/.local/bin:$HOME/.local/usr/bin:$HOME/Django-1.5/bin/:$PATH

#User specific aliases and functions


alias mv='mv -i'
alias rm='rm -i'
alias cp='cp -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
~
~


After struggling more than 6 hours, I decided to ask for help.


Mission: To create a project with the help of Django
Tools: Windows Vista, Putty SSH
Location: Bluehost (www.bluehost.com) Server


I have already read these topics about the same question:



  1. -bash: django-admin.py: command not found (Django Installation)

  2. Unable to use django-admin.py

  3. Django: When creating a new project, “django-admin.py: command not found” Error pops up

  4. django-admin.py: command not found

  5. Command not found: django-admin.py

  6. Django-admin.py not working (-bash:django-admin.py: command not found)


I have installed Python as explained here (Bluehost Help Page):
https://my.bluehost.com/cgi/help/python-install


Python 2.7.2 installed and checked, and it looks like:


username@domain.com [~/python]# ls
./ ../ Python-2.7.2/ Python-2.7.2.tgz bin/ include/ lib/ share/

the directory ~/python/Python-2.7.2/ looks like this:


username@domain.com [~/python/Python-2.7.2]# ls
./ LICENSE Objects/ build/ pyconfig.h.in
../ Lib/ PC/ config.log python*
.hg_archival.txt Mac/ PCbuild/ config.status* python-gdb.py
.hgtags Makefile Parser/ configure* setup.py
Demo/ Makefile.pre Python/ configure.in
Doc/ Makefile.pre.in README install-sh*
Grammar/ Misc/ RISCOS/ libpython2.7.a
Include/ Modules/ Tools/ pyconfig.h

and ~/python/bin/ looks like this:


username@domain.com [~/python/bin]# ls
./ 2to3* idle* python* python2.7* smtpd.py*
../ django-admin.py* pydoc* python-config@ python2.7-config*

Django 1.5 installed and checked, and it looks like:


username@domain.com [~/Django-1.5]# ls
./ AUTHORS LICENSE PKG-INFO build/ docs/ scripts/ setup.py
../ INSTALL MANIFEST.in README.rst django/ extras/ setup.cfg tests/

and ~/Django-1.5/bin/ looks like this:


username@domain.com [~/Django-1.5/django/bin]# ls
./ __init__.py django-2to3.py* profiling/
../ daily_cleanup.py* django-admin.py* unique-messages.py*

Problem: When I try to create my project, I see this error:


username@domain.com [~/www/domain/]# django-admin.py startproject mysite
-bash: django-admin.py: command not found

Then I have tried again without .py, I see this error:


username@domain.com [~/www/domain/]# django-admin.py startproject mysite
-bash: django-admin.py: command not found

~/.bashrc looks like this:


# .bashrc
export PATH=$HOME/.local/bin:$HOME/.local/usr/bin:$PATH

#User specific aliases and functions


alias mv='mv -i'
alias rm='rm -i'
alias cp='cp -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
~
~

~/bin/ looks like this:


username@domain.com [~/bin]# ls
./ ../

So I read a lot about the PATH, but I could not make it work. Should I give up?



Modify your .bashrc PATH entry to look like:


export PATH=$HOME/Django-1.5/bin/:$HOME/.local/bin:$HOME/.local/usr/bin:$PATH

And reload your .bashrc by doing:


# . ~/.bashrc


Add django path to your $PATH.


Change you ~/.bashrc to


# .bashrc
export PATH=$HOME/.local/bin:$HOME/.local/usr/bin:$HOME/Django-1.5/bin/:$PATH

#User specific aliases and functions


alias mv='mv -i'
alias rm='rm -i'
alias cp='cp -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
~
~

0 commentaires:

Enregistrer un commentaire