I am reading a book (\"Learning Django Web Development\" by Sanjeev Jaiswal and Ratan Kumar) on Django, but the book is based on an earlier version of Django (prior to version 1
For Django 2
User.objects.create_superuser(username='name',email='email',password='password')
From the docs
create_superuser(username, email, password, **extra_fields)
Same as create_user(), but sets is_staff and is_superuser to True.
Which can be embedded in a script, called from a command line or triggered via an API