Check the Django admin screen. Until now, I had opened http://127.0.0.1:8000/posts/, but I changed the posts part to admin and [http If you open http://127.0.0.1:8000/admin/, you can see the screen below. In this state, you cannot log in yet, so create an account next.
At the command prompt, do the following:
$ python3.6 manage.py createsuperuser
username(leave blank to use 'kazunari'): (Enter your favorite user name)
mail address: ************@gmail.com
Password:
Password (again):
Superuser created successfully.
Enter your user name, email address, and password, and then enter your password again to complete the creation.
If you log in using the account you registered earlier on the Admin screen, the following management screen will be displayed.
Display the created application (Posts) on the management screen. Add to admin.py in posts> template.
admin.py
from django.contrib import admin
from .models import Post #Added line
admin.site.register(Post) #Added line
Import the Post class from models.py. Then, write the program to be added to the Admin screen.
By doing so, you will be able to access the posts function from the management screen and add, edit, or delete data.
Recommended Posts