Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
731 views
in Technique[技术] by (71.8m points)

python - django-admin.py prints help only

I am using django 1.3.1

I followed the online tutorial and tried to use "django-admin.py startproject mysite".

But I always receive this:

D:Codedjtest>django-admin.py startproject mysite
Usage: django-admin.py subcommand [options] [args]

Options:
  -v VERBOSITY, --verbosity=VERBOSITY
(...)

What is going on?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had exactly the same problem and solved it using this tool: FileTypesManager

The problem is that django-admin.py is not receiving the correct arguments from the command line. I did a test by hacking a couple of lines into the front of the admin script to display the number of arguments and what they were before it did anything else. The hack:

    #!d:python27python.exe
    from django.core import management
    import sys
    print 'Number of arguments:', len(sys.argv), 'arguments.'
    print 'Argument List:', str(sys.argv)

    if __name__ == "__main__":
       management.execute_from_command_line()

When you run django-admin.py you will see that there is only 1 argument ever being passed. Which is not correct.

As suggested in several forums, I tried both of the following at the command line, and both looked spot on:

    assoc .py            -->  .py=Python.File
    ftype Python.File    -->  Python.File="D:Python27python.exe" "%1" %*   //Correct

I then looked in the registry and the values looked good as well.

However, when I ran FileTypesManager, (it's free) it showed something different. The command-line was set as:

   "D:Python27python.exe" "%1"      //Wrong!

I have no idea why, but as soon as I updated this value it all worked flawlessly.

I hope that helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...