Creating A Super User In Django

2 min read

Django's prominent feature is the admin interface, which makes it stand out from the competition. It is a built-in app that automatically generates a user interface to add and modify a site's content.

The built-in administration interface that is very useful for editing content. The Django admin site is built dynamically by reading your model metadata and providing a production-ready interface for editing content. You can use it out of the box, configuring how you want your models to be displayed in it.

In order to use the Django's admin app which is already included in django.contrib.admin inside INSTALLED_APPS setting, first we have to create a superuser.

Creating A Super User In Django

In the directory where manage.py script exists, execute the following command.

python manage.py createsuperuser

Now Django will prompt you to enter the details, enter your desired details and hit enter.

Username (leave blank to use 'admin'): admin
Email address: [email protected]
Password: ********
Password (again): ********
Superuser created successfully.

Now that the superuser is created, run the development server.

python manage.py runserver

Open the browser and navigate to http://127.0.0.1:8000/admin/ You should see a login page, enter the details you provided for the superuser.

Django Admin login

After you log in you should see  the Django's admin panel with Groups and Users models which come from Django authentication framework located in django.contrib.auth.

Django admin dashboard


DJANGO

Latest Articles

Latest from djangocentral

Capturing Query Parameters of request.get in Django

In Django, the request object contains a variety of information about the current HTTP request, including the query parameters. Query parameters are a way to pass additional information in the URL and are used to filter or sort data. The request object p…
Read more →

2 min read

Understanding related_name in Django Models

In Django, related_name is an attribute that can be used to specify the name of the reverse relation from the related model back to the model that defines the relation. It is used to specify the name of the attribute that will be used to access the relat…
Read more →

2 min read