views:

242

answers:

2

I apologize in advance for my noobness. I tried to create a new project with "django-admin.py startproject blah" and I got an error saying "startproject" is an unknown option for django-admin.py. This can't be normal. I then did "django-admin.py help" and viewed the possible arguments, and they were the same as the arguments for manage.py (startapp, sqlall, sqlflush). What on earth is going on?

+5  A: 

If you are already in a project, startproject is explicitly removed from manage.py and django-admin.py. From the docstring to django.core.management.get_commands:

If a settings module has been specified, user-defined commands will also be included, the startproject command will be disabled, and the startapp command will be modified to use the directory in which the settings module appears.

Daniel Roseman
This is correct. You need to back out of your existing project directory before you start a new one.
Paul McMillan
Thank's very much,you guys saved me.
twneale
+1  A: 

From the Django Documentation:

[startproject] is disabled [...] when the environment
variable DJANGO_SETTINGS_MODULE has been set. To
re-enable it in these situations, [...] unset
DJANGO_SETTINGS_MODULE.

I ran across this just the other day and it caused me some amount of groaning when I finally figured it out.

Zarkonnen
Sorry for the ugly formatting. The underscores in DJANGO_SETTINGS_MODULE don't get rendered otherwise.
Zarkonnen
Awesome, thank you very much. Problem de-mystified! Next time I will RTFM.
twneale