Django-admin.py is not working properly

I just noticed that something is wrong with my django-admin.py team. I checked similar SO posts on django-admin.py problems, but nothing seems to be related to my problem. I am using Windows Vista (yes, I know ...). I also have many versions of django in some folder on my disk, and I will switch to the version I need using the junction command (this is similar to symlinking in unix), I have no problems with this and I never had problems.

I used django-admin.py many times before, but now for some unknown reason I got this information (Django 1.1.1):

C:\>django-admin.py startproject some_project Type 'django-admin.py help' for usage. 

and amazingly when I type what django asked me to type:

 C:\>django-admin.py help Type 'django-admin.py help' for usage. 

????

When I switch to Django 1.2.1, I got the following:

 C:\>django-admin.py startproject help Usage: django-admin.py subcommand [options] [args] Options: -v VERBOSITY, --verbosity=VERBOSITY Verbosity level; 0=minimal output, 1=normal output, 2=all output --settings=SETTINGS The Python path to a settings module, eg "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used. --pythonpath=PYTHONPATH A directory to add to the Python path, eg "/home/djangoprojects/myproject". --traceback Print traceback on exception --version show program version number and exit -h, --help show this help message and exit Type 'django-admin.py help <subcommand>' for help on a specific subcommand. Available subcommands: cleanup compilemessages createcachetable ... startproject ... validate 

regardless of whether I startproject help or startproject some_name , the same message is always displayed.

Any ideas?

EDIT: New Information

I just noticed that my command line arguments are not visible when the command is parsed by the django managament utlity command (when I print the argv command, it only shows the path to django-admin.py without any given arguments)

+4
source share
2 answers

The problem in my case was that I lost the .py file association rules.

If you have a similar problem, you can check on the command line what is the result:

 assoc .py 

If there is no such association, you need to create it:

 assoc .py=Python.File 

and create a rule for Python.File:

 ftype Python.File="c:\python27\python.exe" "%1" %* 

(Replace everything with that path for your python interpreter.)

now django-admin.py takes command line arguments and everything works fine!

+8
source

This would be better since it does not require touching the registry at all:

fooobar.com/questions/769637 / ...

0
source

Source: https://habr.com/ru/post/1313946/


All Articles