A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/python/how-to-create-superuser-in-django/ below:

How to create superuser in Django?

How to create superuser in Django?

Last Updated : 15 Jul, 2025

Django comes with a built-in admin panel that allows developers to manage the database, users and other models efficiently. This eliminates the need for creating a separate admin interface from scratch. To access and manage the Django Admin panel, we need to create a superuser i.e. a user with full administrative privileges.

Prerequisites

Before creating a superuser, ensure that

python manage.py migrate

This step ensures that the necessary database tables, including those for authentication, are created.

Steps to Create a Superuser

To create a superuser in Django, follow these steps:

1. Navigate to the Project Directory: Open your terminal or command prompt and move to the directory where your manage.py file is located.

cd path/to/your/django/project

2. Run the Superuser Creation Command: Execute the following command to initiate the superuser creation process:

python manage.py createsuperuser

3. Enter Required Details: The system will prompt you to enter details for the superuser:

Username: admin

Email address: admin@example.com

Password: ********

Password (again): ********

Note: Ensure your password meets the security requirements set by Django. If it is too weak, Django may ask you to enter a stronger password.

4. Successful Superuser Creation: If all fields are entered correctly, you will see a confirmation message:

Superuser created successfully.

Image shown after above steps done  Logging into the django admin panel

Once the superuser is created, follow these steps to log in:

1. Start the Django development server:

python manage.py runserver

2. Open your web browser and navigate to the Django admin login page:

http://127.0.0.1:8000/admin/

3. Enter the Username and Password you set while creating the superuser.

4. Click Login, and you will be redirected to the Django Admin Dashboard, where you can manage your application’s models, users and data.               

Django admin page Additional Tips

python manage.py changepassword <username>

python manage.py shell
from django.contrib.auth.models import User
User.objects.create_superuser('newadmin', 'admin@example.com', 'securepassword')

Related Articles:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4