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

May 8, 2022·

1 min read

Play this article

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:

pythonCopy codepython 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:

pythonCopy codeSuperuser 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:

pythonCopy codefrom 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.