django-admin.py prints help only

前端 未结 6 517
无人共我
无人共我 2020-12-20 17:28

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         


        
相关标签:
6条回答
  • 2020-12-20 18:03

    Try giving the full path to the project dir even though it's in your PATH

    0 讨论(0)
  • 2020-12-20 18:05

    If you are on Windows 7, update the registry entry at:

    HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command
    

    to have the value:

    "C:\Python27\python.exe" "%1" %*
    

    (modify the above value if you have installed python in a different location)

    0 讨论(0)
  • 2020-12-20 18:09
    1. Open regedit
    2. go to HKEY_CURRENT_USER\Software\Classes\py_auto_file\shell\open\command
    3. change to "C:\Python27\python.exe" "%1" %*

    It works for me.

    0 讨论(0)
  • 2020-12-20 18:10

    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.

    0 讨论(0)
  • 2020-12-20 18:17

    In regedit under
    HKEY_CURRENT_USER\Software\Classes\Applications\python.exe\shell\open\command
    modify the entry from

    "<your drive>:\Python<version>\python.exe" "%1"
    

    to

    "<your drive>:\Python<version>\python.exe" "%1" %*
    

    I had the same problem and I resolved it this way.

    0 讨论(0)
  • 2020-12-20 18:27

    In case anyone still has this problem, there is no need to mess with your registry. Here is the answer you need: here

    Basically it's:

    Add 'python' before django-admin.py (or add full path to python.exe).

    C:\Shekhar\djangoWorld>python c:\Python27\Scripts\django-admin.py startproject mysite

    Which means you are running the django-admin.py as an arguement to the python interpreter; as against running it as a stand-alone script, in which case it doesn't actually get the supplied arguements for some reason.

    0 讨论(0)
提交回复
热议问题