﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7518	django-admin.py syncdb cannot createsuperuser	Karen Tracey <kmtracey@…>	nobody	"Problem reported on django-users: http://groups.google.com/group/django-users/browse_thread/thread/1426b66cb9cf0155

If you try to use 'django-admin.py syncdb' instead of 'python manage.py syncdb' to initialize a new database and create a superuser, the command fails like so:

{{{

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Error: Unknown command: 'createsuperuser'

}}}

django-admin.py calls django.core.management.execute_from_command_line()

while 

manage.py calls django.core.management.execute_manager(settings)

The first creates a !ManagementUtility and calls execute() on it while the 2nd creates a !ProjectManagementUtility and calls execute() on it.  The key difference between these two for this problem looks to be that the first's !__init!__ sets self.user_commands to False while the 2nd sets the same value to True.  This value is passed as load_user_commands to get_commands and as a result the 1st (django-admin.py) does not load commands associated with all the apps in settings.INSTALLED_APPS.  Therefore the auth's createsuperuser command is not found when the auth code runs its registered post_syncdb create_superuser function.

That's why it breaks.  Not sure how to fix it since I don't really understand the distinction between !ManagementUtility and !ProjectManagementUtility and why that user_commands var is different for the two."		closed	Core (Management commands)	dev		duplicate		dane.springmeyer@…	Unreviewed	0	0	0	0	0	0
