How to Add superadmin user account in Django using a Command via Command Line Interface

Posted on

This article will show how to add an user account with the role or type of superadmin. The process for adding that type of user will be using a certain command. Just access the command line interface, then type the following command :

python manage.py createsuperuser --username=username --email=email

If the above command pattern execution is in the execution form using the real example, the output of the command execution will exist as follows :

(myenv) C:\python-win\system>python manage.py createsuperuser --username=admin --email=admin@localhost
Password:
Password (again):
This password is too common.
Bypass password validation and create user anyway? [y/N]: y
Superuser created successfully.
(myenv) C:\python-win\system>

The above command execution is a success. It means, the command execution for creating a new user with the role of ‘superadmin’ is a success. Just specify the name and the email of the new user. In the above command execution, the username is ‘admin’ and the email is ‘admin@localhost’ as an example. The above username and password will be usable to access the administrator dashboard via admin page. Furthermore, the administration dashboard itself exist as the default one from the Django-based web application installation. The following is the display of the administrator login page :

How to Add superadmin user account in Django using a Command via Command Line Interface

By accessing the page using the username of ‘admin’ and its associated password, the following page will appear :

How to Add superadmin user account in Django using a Command via Command Line Interface

In order to see the list of the available users in the Django-based web application, just click the Users link. The following image of the list of the users page will appear :

How to Add superadmin user account in Django using a Command via Command Line Interface

As in the above image, there is only one user available from the previous command execution in the command line. That is the command for creating a new user.

Leave a Reply