Django comes with an automatic admin interface.

You just created a (database) model in the previous article. Now we can create a backend management tool for it. This is one of the most powerful features of Django.

If you want, you can easily put your Django app online instead of having a “works on my pc” app.

Related course:
Django Web Developer Course

Admin interface

You can open the admin interface with a web browser, but to open the admin interface, first we need to change a file. Open the file movies/
This is the file contents:

from django.contrib import admin

# Register your models here.

Lets add some code:

from django.contrib import admin
from .models import Movie

Start the Django server:

python runserver

Open the url: /admin/

Admin login

If everything went right, the Django-admin login screen will popup. Let’s enter the matrix!

django admin

Django admin add user

Create a superuser.

python createsuperuser

Type a username and password. You should see this message:

Superuser created successfully.

Now open the webpage again and login.

The admin screen

If you see the screen below, good job!

django site admin

The model ‘Movie’ is there!

Django admin add

If you click on the model, a new screen shows up:

django add to model

We can add new movies here. If you click on the button, all the fields are there to add a new movie, exactly as we specified it in the model.

django insert into database

How cool is that?

All the CRUD operations work.

Note: CRUD is short for create, read, update and delete. Common database operations

We can now interact with the complete database system from this graphical interface.