Opened 9 years ago

Closed 9 years ago

Last modified 5 years ago

#7518 closed (duplicate) syncdb cannot createsuperuser

Reported by: Karen Tracey <kmtracey@…> Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Keywords:
Cc: dane.springmeyer@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Problem reported on django-users:

If you try to use ' syncdb' instead of 'python 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' calls

while calls

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 ( 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.

Change History (7)

comment:1 Changed 9 years ago by anonymous

#5943 can fix it.

comment:2 Changed 9 years ago by Karen Tracey <kmtracey@…>

Resolution: duplicate
Status: newclosed

Looks like #5943 will be going in, and should fix this.

comment:3 Changed 8 years ago by anonymous

I frequently use so here's a call out that fixing this would be really useful.

comment:4 Changed 8 years ago by anonymous

Cc: dane.springmeyer@… added

comment:5 Changed 8 years ago by Karen Tracey <kmtracey@…>

#5943 is the one you really want to follow, this one has been closed in favor of that one.

comment:6 Changed 8 years ago by Alex Yu <stinky9@…>

This is how I fixed the problem temporary...

cd django/core/management/commands
ln -s ../../../contrib/auth/management/commands/ .

comment:7 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top