Django – starting with the admin panel
The admin panel lets you manage your models (i.e. the Django data in the database). It is not really meant for use in the production system, but it is very useful during development and for sysadmin
- Create a super user (so you can log in)
- (DjangoTest) python manage.py createsuperuser
- Enter username, email address and password
- In your browser, go to http://localhost:8000/admin
- Enter the log in details from step 1.
- You should now see groups and users. Models you’ve created yourself aren’t there yet
- In your books app folder (<dev root>Projects/HelloWorldDjango/books) edit admin.py, add the following:
from books.models import Book, Author# Register your models here.
admin.site.register(Author)
admin.site.register(Book) - Refresh the admin panel in your browser. You should now see all your models