We do not create a separate “Admin” page or provide an authentication feature because Django provides an “Admin” panel for its users. Furthermore, we must migrate to our project before using this feature; otherwise, we will not be able to create a database of superusers.
We can create a superuser by writing the following command:
python3 manage.py createsuperuser
We then write the following credentials step by step. We can fill these credentials according to our preferences:
Username: testAdminUser
Email address: test@gmail.com
Password: ********
Password (again): ********
Note: After filling a row, press “Enter” to fill the other information.
Now the superuser will be created if we have entered all fields correctly.
A sample “Hello World” Django application is given below. We can follow the given steps to test our knowledge:
python3 manage.py createsuperuser
in the given terminal and press “Enter”.python3 manage.py runserver 0.0.0.0:8000
and press “Enter”.from django.db import models # Create your models here.
Now we can find our application by clicking on the link below the “Run” button.
To see the login page for the Django “Admin” site, we need to append /admin/
at the end of our base URL.
For example, if the application is running at http://127.0.0.1:8000
, we can access the admin panel at http://127.0.0.1:8000/admin/
.
Free Resources