Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top