Welcome back in the second part of the lesson.
We're going to learn how to set up a registration at point for our profiles EPA project so that users
are going to be able to create in your accounts the arrest and to do so.
We are now going to install another package called Django author which is a dependency of Django rest
of basically Django stuff.
Use this part of the code that is provided by this package to set up the registration point that will
then go into use.
So you're just going to give the command pip install Django allows the
and I can also update the requirements though the 65 so deep freeze requirements not to 60.
Perfect.
We now need to install the package so yeah I'm going to add a loss.
Then I love that account and all of that.
So shall we need to register all three of them because Django Love is a very powerful package and it
also allows us to provide the social network authentication for Django projects such as for example
using Facebook or Twitter for authentication.
However clearly that's not something that we're going to discuss because it goes well beyond the scope
of the course.
But I'm going to leave you some reference links in the PDA files and the slides.
Therefore I suggest you download them and check them out if you need to.
So we said that the rest of uses Orloff as a dependency.
And specifically it's the rest of DOT registration which uses it this configuration is not finished
yet.
We need to import yet another application this time from Django itself which is Django that contribute
that site down here by the end of a file.
We need to add site I.D. equals one account email verification equals and we can set just not specifically
fire and account email required we can anyway set through clearly as you might have imagined all those
settings.
Because of these apps that we've installed and I actually now see that this is not all law the social
but a all of the social count and we can now give that migrate command.
So I'm just going to open up the terminal.
Once again like so.
So profile CPI Python managed not by my great all the migrations that applied.
We can say now that site administration interface I can just close the third I mean.
Let's go to Chrome and you see that now we've got the accounts application we email addresses but we
also got the site's application which is used by all that software machinery of the package that we've
installed.
We can just forget about it and then we've got the social accounts application you see we've social
accounts social application talks and social applications.
Again we just don't need to think about them because we are actually going to register new accounts
via arrest.
We've another a simple client that we're going to write using requests.
Of course if you want to you can also use a software like for example postman to check all the different
points and in fact you are going to use postmark later on during the course.
However at the moment I think that for the sake of explaining all the new concepts that we are discussing
building the client herself is a much better choice.
But before doing that we actually need to include the registration points.
So basically define the U.S. real end points that we are going to need to actually register new accounts
to be addressed.
So I'm just going to copy this line like so and this is going to be API arrest author registration and
this time we want to include the rest of the registration that you had else.
OK.
So we have now ready to create another file within the client's folder so I can just call it so I can
of test to that by and I can actually just copy all the code we've written in the previous file and
at the moment we're not going to need any of these.
We need however to uncle meant the previous lines.
And so in order to create a new account of course we're going to need a username and password password
configuration and any mail field so I can just call this data and we can do something like this one
too.
This is going to be data.
And so we need user name then we need e-mail we can just set something like test at rest that's com
and these can be just called rest.
Test them ambassador is going to be password one we can just set change me.
One two three and then we're going to need that password confirmation which is going to be called Password
2.
Then of course the end point is going to be different is not the logging endpoint but the registration
and bind.
And do we have no ready to execute the script.
So let's restart the development server
like so.
And you also need a second terminal.
So go and change directory clients.
Let's run a script and let's see what happens.
So Python took enough test to do it by.
Awesome.
We get status code 200 and you see we also get the right away and authentication token for adding new
account.
And it is important to note that we've registered a new account but of course because of the sickness
we've set in the previous lessons we also get a new profile instance associated with it.
So let's go back to site administration and let's check users and edit e's are addressed.
Test user let's check the profiles profiles and entities.
So let's now try to use indication talk and provide it right away.
OK goes to change it to make a get request going to comment this out to the same endpoint that we've
previously used the profiles end point.
So once again let's open this up and let's execute a script and did it is as expected standards go to
Android.
OK.
We get out at least we will the Jasons of the different profiles in our database you see did we also
have the third one we've created rest test with primary key three.
OK.
So that was it for these lectures about the Django rest of the package.
In the next one we are going to see if to set up all the remaining endpoints for our rest api using
view sets and routers.