Admin Page

Django comes with a default admin site that allows us to do lots of things in the backend.

Before creating a user who can log in to the admin site, we need to create migration and database with the following command.


$ python makemigrations

Apply the mirgration

$ python migrate

Create admin login

$ python createsuperuser

Enter your desired username and press enter.

Username: admin

You will then enter your desired email address:

Email address:

The final step is to enter your password. You will be asked to enter your password twice, the second time as a confirmation of the first.

Password: **********
Password (again): *********
Superuser created successfully.

Start the development server

The Django admin site is activated by default.

We can start the development server python runserver and access our admin page at:

Try logging in with the superuser account you created in the previous step, and you’ll see the Django admin index page.

On the admin page, you can create new users, check your history and manage posts.

Make the app modifiable in the admin

To display our blog app on the admin index page, we access blog/ file, and edit:

from django.contrib import admin
from .models import Post

# Register your models here.