0
0
Djangoframework~3 mins

Creating superuser in Django

Choose your learning style9 modes available
Introduction

A superuser is an admin user with full control over your Django project. You create it to manage your site easily.

When you want to log into the Django admin panel to add or edit data.
When setting up a new Django project and need an admin account.
When testing admin features during development.
When you want to manage users and permissions through the admin interface.
Syntax
Django
python manage.py createsuperuser

This command runs in your terminal inside your Django project folder.

You will be asked to enter a username, email, and password.

Examples
Runs the command to start creating a superuser interactively.
Django
python manage.py createsuperuser
Creates a superuser with a preset username and email, then prompts for a password.
Django
python manage.py createsuperuser --username admin --email admin@example.com
Sample Program

This shows the typical terminal interaction when creating a superuser. You type the command, then enter username, email, and password when asked.

Django
python manage.py createsuperuser
# Then follow prompts:
# Username: admin
# Email address: admin@example.com
# Password: ********
# Password (again): ********
# Superuser created successfully.
OutputSuccess
Important Notes

Make sure your password is strong to keep your admin safe.

If you forget your superuser password, you can create a new one or reset it via the database.

You must run this command inside your Django project folder where manage.py is located.

Summary

Use python manage.py createsuperuser to make an admin user.

This user can log into the Django admin site to manage your project.

Follow the prompts to enter username, email, and password.