Tech With Tim Logo
Go back

Admin Page

Django Admin Page

You may have noticed in previous tutorials that there exists a link to a page called "admin". In this tutorial we will cover what this page is used for and how to register our database so that we can login and view it from here.

Creating an Admin Login

If you navigate to the django admin page you will notice that it asks you for some login information. However, right now we have no login. To create a login we need to navigate to the directory containing migrate.py and run the following command: python manage.py createsuperuser kuva_2023-04-25_145411263.png

Once you have created a user run the server by running python manage.py runserver and navigate to the "admin/" address. Here you can use your login information to login.

You should see a page that looks like this: kuva_2023-04-25_145441766.png

Adding Our Database

This page is meant to show us (the admin) information about our site and database. To add our database to this dashboard we need to modify the admin.py file from within our app directory.

from django.contrib import admin
from .models import ToDoList, Item
# Register your models here.
admin.site.register(ToDoList)
admin.site.register(Item)

Now if we save our changes and refresh the site we should see our databases added. kuva_2023-04-25_145542726.png

Design & Development by Ibezio Logo