Django News Issue 16 shared this:
hartwork/django-createsuperuserwithpassword: Django management command to create usable super users, programmatically
Django management command to programmatically create usable super users. This is great for local Docker development, but please skip for production.
The question I have is: What is the better way of doing non-interactive superuser account creation in production?
You could create a management command like hartwork did, or you could run things like:
echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'email@example.com', 'supersecretpass')" | python manage.py shell
But that may/may not handle custom User models, etc, but the basis of piping ORM code code into a
manage.py shell is another way to go about this task.
But what is the best way as of Django 3.0 to do non-interactive superuser creation?
I appreciate your input!