Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"startproject" option disappeared from django-admin.py

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?

like image 837
twneale Avatar asked Jan 29 '26 14:01

twneale


2 Answers

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.

like image 52
Daniel Roseman Avatar answered Jan 31 '26 11:01

Daniel Roseman


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.

like image 40
Zarkonnen Avatar answered Jan 31 '26 10:01

Zarkonnen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!