Tue. Mar 28th, 2023

A quick intro on how to create a super user in Django to be able to access the admin site on a fresh project.

In our previous post we created a base Django web app and got it up and running.

If you’ve done the same you have probably seen this page:

Initial Django screen

If you visit http://127.0.0.1:8000/admin you’ll see a screen like this:

The Django admin login page

And if you’ve seen the above page then you are probably trying to get access to the admin panel to either poke around or start developing.

In order to do this we need to create a super user.

Creating an Admin superuser

Within your project root run the following command:

python .\manage.py createsuperuser

Complete the details:

Username (leave blank to use 'john'): 
Email address:
Password:
Password (again):
Superuser created successfully.

Then fire up your app once more with:

python manage.py runserver

Then visit the admin url http://127.0.0.1:8000/admin and enter the username and password you entered during the superuser creation:

You’ll not be able to access the admin area of your Django web app:

By admin