Create the Django Superuser Account
The next step in building our app is to create our superuser account. Django comes with “batteries included” and one of those included batteries is an authentication system. Before we can take advantage of this useful feature, we have to set up an administrative account with full privileges. Django calls this the superuser account, and we can create it with a
manage.py command, specifically
00:12 It’s often said that Django comes with batteries included, and one of these included batteries is an authentication system. Before we can take advantage of this very useful feature, we have to set up an administrative account with full privileges.
So let’s do that now. This script is going to ask you for an account username and password, so have that in mind before you begin. Launch your terminal and at the prompt, type
python manage.py createsuperuser.
Let’s log in with our new account. Go back to your editor for a moment and take a look at the project’s
urls.py file. Remember I said this works as a sort of front desk for your site to route incoming requests.
There’s a route here configured as
'admin/'. Now open your terminal and type the
manage.py runserver command to launch your site. When the site launches, click the
localhost link to see your site in the browser.
As you probably guessed, that’s what we’re going to do next. Join me in the next video, where we will not only add the
shop table to our admin interface, but load the table with some initial data records using Django migrations.
Become a Member to join the conversation.