Code

Opened 5 years ago

Closed 5 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: UI/UX:

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.

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

startproject is documented here: http://docs.djangoproject.com/en/dev/ref/django-admin/#startproject-projectname

The behavior of the command being disabled when the environment variable has been set, is also documented there.

django-admin.py does also document startproject, 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.