首页 文章

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

提问于
浏览
2

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

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

I have already read these topics about the same question:

我按照此处的说明安装了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*

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

然后我再次尝试没有.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
./  ../

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

2 回答

  • 1

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

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

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

    # . ~/.bashrc
    
  • 0

    将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
    ~
    ~
    

相关问题