django-admin.py:找不到命令(bluehost服务器)

时间:2013-03-28 00:04:11

标签: python django python-2.7 django-admin bluehost

经过6个多小时的挣扎,我决定寻求帮助。

使命:在Django的帮助下创建项目 工具:Windows Vista,Putty SSH
位置:Bluehost(www.bluehost.com)服务器

我已经阅读了有关同一问题的这些主题:

  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)
  7. 我按照此处的说明安装了Python(Bluehost帮助页面):
    https://my.bluehost.com/cgi/help/python-install

    安装并检查了Python 2.7.2,它看起来像:

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

    目录〜/ python / Python-2.7.2 / 如下所示:

    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
    

    〜/ python / bin / 看起来像这样:

    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,它看起来像:

    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/
    

    〜/ Django-1.5 / bin / 看起来像这样:

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

    问题:当我尝试创建项目时,我看到了这个错误:

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

    然后我再次尝试没有.py,我看到了这个错误:

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

    〜/ .bashrc看起来像这样:

    # .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 /看起来像这样:

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

    所以我读了很多关于 PATH 的内容,但我无法让它发挥作用。我应该放弃吗?

2 个答案:

答案 0 :(得分:2)

修改您的.bashrc路径条目,如下所示:

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

通过执行以下操作重新加载.bashrc

# . ~/.bashrc

答案 1 :(得分:1)

将django路径添加到$PATH

~/.bashrc更改为

# .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
~
~