Opened 15 years ago
Closed 15 years ago
#11980 closed (duplicate)
django-admin.py startproject command failed when DJANGO_SETTINGS_MODULE was set
Reported by: | devye | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.1 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If DJANGO_SETTINGS_MODULE evvironmental variable was previously set, you cannot run this command to init a project.
$ django-admin.py startproject fbsample Unknown command: 'startproject' Type 'django-admin.py help' for usage. $ django-admin.py 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 dbshell diffsettings dumpdata flush inspectdb loaddata makemessages reset runfcgi runserver shell sql sqlall sqlclear sqlcustom sqlflush sqlindexes sqlinitialdata sqlreset sqlsequencereset startapp syncdb test testserver validate
It's been documented here:
http://thingsilearned.com/2008/12/28/django-adminpy-startproject-unknown-command/
The only workaround should be unsetting DJANGO_SETTINGS_MODULE:
$ export DJANGO_SETTINGS_MODULE= $ django-admin.py startproject fbsample $ ls fbsample __init__.py manage.py settings.py urls.py
Also, django-admin.py script should document this "startproject" command.
Note:
See TracTickets
for help on using tickets.
startproject
is documented here: http://docs.djangoproject.com/en/dev/ref/django-admin/#startproject-projectnameThe behavior of the command being disabled when the environment variable has been set, is also documented there.
django-admin.py
does also documentstartproject
, so long as it has not been deleted as a result of having the environment variable set. Changing the script to note that the command has been disabled instead of completely deleting it is covered by #8329.