Creating admin login credentials for Django

This post describes how you can create a user who can login to the django admin site. For previous steps to create your django project refet to “Starting webserver using your first simple Django project”

$ python manage.py createsuperuser

Enter your desired username and press enter. By default, above command takes your machine username as admin username if you decides to leave below input blank and pressed enter.

Username (leave blank to use ‘devlab’): admin

You will then be prompted for your desired email address:

Email address: admin@lynxbee.com

You will then be prompted to enter the admin users login password, which you can enter and confirm by entering again as below,

Password:
Password (again):

here, as you can see we created username as “admin” and tried to set the password as “admin123” but it shown following warning, which we took it seriously and said “N” when asked to proceed with unsecure and common password.

The password is too similar to the username.
This password is too common.
Bypass password validation and create user anyway? [y/N]: N

After which it asked to enter the password again and we entered it with some number, alphabet combination to make it more secure.

Password:
Password (again):

Superuser created successfully.

Now, start the server again,

$ python manage.py runserver

And visit “http://127.0.0.1:8000/admin/” for log-in to dashboard.

Leave a Comment