Help only django-admin.py

I am using django 1.3.1

I went to an online tutorial and tried using "django-admin.py startproject mysite".

But I always get this:

D:\Code\djtest>django-admin.py startproject mysite Usage: django-admin.py subcommand [options] [args] Options: -v VERBOSITY, --verbosity=VERBOSITY (...) 

What's happening?

+7
source share
6 answers

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

The problem is that django-admin.py is not getting the correct arguments from the command line. I did a test by breaking a couple of lines in the front of the admin script to display the number of arguments and what they were before it did anything else. 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 only one argument is passed. This is not true.

As suggested in several forums, I tried both from the command line, and both looked like this:

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

Then I looked through the registry and the values ​​looked good.

However, when I ran FileTypesManager , (it's free), it was showing something else. 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 this helps.

+7
source

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

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

to make a difference:

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

(change the above value if you installed python elsewhere)

+3
source

In regedit under
<i> HKEY_CURRENT_USER \ Software \ Classes \ Applications \ python.exe \ Shell \ open command \
change entry from

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

to

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

I had the same problem and solved it that way.

+1
source

In case anyone else has this problem, there is no need to contact the registry. Here is the answer: here

Mainly:

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

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

This means that you are running django-admin.py as an argument to the python interpreter; as opposed to running it as a stand-alone script, in which case for some reason it does not actually receive the supplied arguments.

+1
source

Try to give the full path to the project file, even if it is in your PATH

0
source
  • Open regedit
  • go to HKEY_CURRENT_USER \ Software \ Classes \ py_auto_file \ shell \ open \ command
  • change to "C: \ Python27 \ python.exe" "% 1"% *

This works for me.

0
source

All Articles