This may be a duplicate, but I couldn't find the question anywhere, so I'll go ahead and ask:
Is there a simple way to delete a superuser from the terminal, perhaps analogous to Django's createsuperuser
command?
There is no way to delete it from the Terminal (unfortunately), but you can delete it directly. Just log into the admin page, click on the user you want to delete, scroll down to the bottom and press delete.
superuser. - The most powerful user with permissions to create, read, update and delete data in the Django admin, which includes model records and other users.
Note that this won't prevent from setting a user as being a superuser from django admin interface. If you want to completely make it impossible to create two superusers, you can add the constraint on the database level directly.
There's no built in command but you can easily do this from the shell:
> python manage.py shell $ from django.contrib.auth.models import User $ User.objects.get(username="joebloggs", is_superuser=True).delete()
No need to delete superuser...just create another superuser... You can create another superuser with same name as the previous one. I have forgotten the password of the superuser so I create another superuser with the same name as previously.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With