This section covers the key tasks that you need to in order to set up the admin site, which allows you to manage data in your website built with django.
Please note that this is site provides the most commonly used django features. It is by no means intended to be an exhaustive documentation of the Django framework. You can always use the official django documentation by clicking the big green button below.
Django Admin DocsIn order to begin using the admin site, you must frist migrate the models you previously created. To do this first run in the terminal:
python manage.py makemigrations
Then run:
python manage.py migrate
The next step is to set up a super user for to access the admin site. Here you will setup a username and password. To do this, execute the following in the terminal, and then follow the command prompts:
python manage.py createsuperuser
In order to see items in the admin site, you'll need to add the models to the admin site. First in your <app_name>/admin.py file, import your models near the top, by adding:
from .models import *
In your same <app_name>/admin.py file, you'll need to register your models to the admin site. To do this add the following line for each model that you created:
admin.site.register(<model_name>)
Then in the terminal, type:
python manage.py runserver
Then head over to /admin, enter your username and password, and you're all ready to use the admin site!