django-admin.py is not working properly
I have just spotted that something is wrong with my django-admin.py command. I checked similar SO posts on django-admin.py problems but nothing seems to be related to my problem. I use Windows Vista (yeah, I know...). I also have many versions of django in some folder on my disk and I switch to the version I need using junction command (this is similar to symlinking in unix), I don't have problems with this and never had problems before.
I used django-admin.py many times before but now for some unknown reasons I got this info (Django 1.1.1):
C:\>django-admin.py startproject some_project
Type 'django-admin.py help' for usage.
and suprisingly 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 this:
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, e.g.
"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, e.g.
"/home/djangoprojects/myproject".
--traceback Print traceback on exception
--version show program's 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
no matter if I type startproject help
or startproject some_name
it always shows the same message.
A开发者_如何转开发ny ideas?
EDIT: new info
I've just noticed that my command line arguments are not visible when command is parsed by django managament utlity (when I print command argv it shows only path to django-admin.py without any of given arguments)
The problem in my case was the I've lost .py file association rules.
If you have similar problem you can check in command line what is the result of:
assoc .py
If there is no such association you need to create it:
assoc .py=Python.File
and create rule for Python.File:
ftype Python.File="c:\python27\python.exe" "%1" %*
(Replace with whatever the path is to your python interpretter.)
now django-admin.py accepts command line args and everything works fine!
This would be better as it does not require touching the registry at all:
https://stackoverflow.com/a/10732170/1585863
精彩评论