Okay, In this video, we will create our routing and we'll create URLs.
So we have our application here now and we have URLs here.
I can remove that and comment for now and we'll have at the moment simple admin here and that's our
path to admin.
But what we can do is we can actually add our second URL level.
So I will create a new file and I will name it urls.py and that will be URL for our API here at the
moment.
I will just copy that and paste it here.
So that will be, let's name it for a moment new.
That is just a placeholder.
So I will have a new file to refer to.
So what I can do here is I can add another path, so I will duplicate the whole line.
I clicked command D So that's duplicating the whole line and the new path is API.
So whatever we will go to API, we want to include our URL from the API URLs.
We need to import that first.
So from Django Django conf urls we will import.
Include and that include we can use here.
So include and then we can do include API URLs like that.
So what else we need to do?
We from here we refer to admin or to API.
What we need to do is we need to register also our API in installed apps.
So we need to do actually two things so we haven't register rest framework yet, framework like that
and we can register our application, which is API as you can see here.
So once I have that in the installed apps, I will need to also go to terminal and I will do Python
three Manage.py migrate.
Not to apply.
Everything is good.
If you have something, then it will be applied.
Then we have this admin and we have API.
If I go here now.
You can see here two parts are available admin and API.
So admin is working as it was before and then api, I can go here and the API slash and you can see
here that new is available already for us.
And at the moment it's just a placeholder because we don't have anything here to display, but we will
build a new models and new things later on and we can create a router for now and we can actually fill
it later on.
So what else is missing?
We haven't created our super user.
We can go to terminal and we can do Python3 Manage.py and then create super user.
And I can leave it blank to Christian and an email address.
I will leave it blank.
So just enter and I will use Christian.
Very unsecure, but I don't mind.
And this is how yes I would like to keep it.
So my username and password is Christian, but please pick something more more secure because if you
at any point will put it on production and someone will discover the username and password, then it
will have an access to all your application.
And remember that creating super user, you create a user with all permissions.
So that might be very dangerous.
Uh, for this tutorial, I don't really care about the security because this is not a live application
and it will never be so Christian.
Christian is just easy to remember in use.
Okay, so we have our user, then we can use our Django here.
What I can do is admin.
And then Christian.
Christian, I can log in.
You can see here everything is kind of working.
So we have our URLs.
So let's build our router and we'll have it ready for later use.
So what we need to do is from rest framework.
Import routers.
And then we can create our router router.
Router's default router here.
And then later on we can actually register some of the models.
At the moment we don't have any models register.
So what we can do is we can only push it to part.
So we will make an empty pad and then we can do include and actually we need to.
Import include the same way as we've done here.
So we'll just copy this.
And that include will include our router router.
URLs like that.
So whatever we will have here, register on the router, it will be available there.
So our URLs are set up.
We have everything written and prepared for us to use.
So in the next video we'll start actually building our data.
So we'll need to create models.
We'll need to create serializers, we'll also need to create views.
So we'll be doing that in the next videos.