8- How to Create an Admin User and Display the Poll App in Django

·

1 min read

Learn how to create an admin user in Django with this step-by-step guide. Follow the instructions below to set up a superuser account and access the admin login screen. You'll also discover how to display the poll app on the admin index page by editing the appropriate file. Whether you're new to Django or looking to expand your skills, this tutorial will help you get started.

To create an admin user, run the following command:

python manage.py createsuperuser

Enter any username, for example, Azad, and press enter. Then enter your email address, for example, . Next, create a password. You should see the following message:

Superuser created successfully.

Now, open a web browser and go to 127.0.0.1:8000/admin. You should see the admin login screen. Try logging in with the superuser account you created in the previous step.

To display the poll app on the admin index page, open the polls/admin.py file and edit it to look like this:

from django.contrib import admin
from .models import Question

admin.site.register(Question)

If you find this content helpful, please consider subscribing to my channel for future updates.