django-admin.py仅打印帮助 [英] django-admin.py prints help only
问题描述
我遵循在线教程,并尝试使用django-admin.py startproject mysite。
但我总是收到这个:
D:\Code\djtest> django- admin.py startproject mysite
用法:django-admin.py子命令[options] [args]
选项:
-v VERBOSITY,--verbosity = VERBOSITY
(...)
发生了什么事?
我有完全相同的问题,使用这个工具解决了:
FileTypesManager
问题是django-admin.py不是从命令行接收正确的参数。我通过在管理脚本的前面插入几行来进行测试,以显示参数的数量,以及在执行任何其他操作之前它们是什么。黑客:
#!d:\python27\python.exe
from django.core import management
import sys
print'参数数:',len(sys.argv),'arguments'
print'参数列表:',str(sys.argv)
如果__name__ ==__main__:
management.execute_from_command_line()
你运行django-admin.py你会看到只有一个参数被传递。这是不正确的。
如在几个论坛中所建议的那样,我在命令行中尝试了以下两个,并且都看起来很像:
assoc .py - > .py = Python.File
ftype Python.File - > Python.File =D:\Python27\python.exe%1%* //正确
然后我查看了注册表,值也很好。
但是,当我运行 FileTypesManager (它是免费的)它显示不同的东西。命令行设置为:
D:\Python27\python.exe%1//错误!
我不知道为什么,但是一旦我更新了这个值,它就会完美无缺地工作。 p>
我希望有帮助。
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:\Code\djtest>django-admin.py startproject mysite
Usage: django-admin.py subcommand [options] [args]
Options:
-v VERBOSITY, --verbosity=VERBOSITY
(...)
What is going on?
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:\python27\python.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:\Python27\python.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:\Python27\python.exe" "%1" //Wrong!
I have no idea why, but as soon as I updated this value it all worked flawlessly.
I hope that helps.
这篇关于django-admin.py仅打印帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!