Support Our Site

To ensure we can continue delivering content and maintaining a free platform for all users, we kindly request that you disable your adblocker. Your contribution greatly supports our site's growth and development.

How To Create 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

How to Use Subquery() in Django With Practical Examples

In the realm of web development, Django stands as a powerful and versatile framework for building robust applications. One of the key aspects of developing efficient and optimized web applications is handling database queries effectively. In this article…
Read more →

4 min read

DRF Serializer: Handling OrderedDict and Converting It to a Dictionary or JSON

In Django Rest Framework (DRF) tests, when you access serializer.data, you might encounter an OrderedDict instead of a regular dictionary. This behavior is intentional and reflects the design of DRF's serialization process.Understanding the Problem The u…
Read more →

3 min read

Django Rest Framework CheetSheet: Mastering API Development

Django Rest Framework (DRF) is a powerful toolkit that makes building robust and scalable web APIs with Django a breeze. Whether you're a seasoned Django developer or a newcomer, having a comprehensive cheat sheet at your disposal can be a game-changer. …
Read more →

5 min read

How to Perform NOT Queries in Django ORM

In Django, performing NOT queries allows you to exclude certain records from the query results based on specific conditions. The NOT operator, represented by the tilde (~) when used in conjunction with the Django ORM's Q object, helps you construct compl…
Read more →

3 min read