Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Confusion of using Django rest Frame work

So there is a thing I have been very confused about and even after search and watching youtube videos still my concept is not clear. I have created an app with frontend in react and used django rest framework for backend because I know the data that comes from react is in json which normal django doesnt understand. so that’s it. Now there is one more app I am working on and my client told me to created an API. Now my questions why would I need an API if the app is only for web can’t I use simple django for it? Or not creating an API and directly interacting with the app is bad idea? also can if I create an API do you think I can use it for mobile backend too. How would registration login and logout things work?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

An API makes it easier for your client to automate web site management, connect mobile apps, create a richer front-end experience, and integrate your work with other applications. With an API, they can build each new component over time instead of all at once, so a cash-strapped client can start with a web experience, then add a mobile app later. The mobile app could even be made by a different developer, enabling your client to hire a mobile app specialist instead of a general developer.

Registration, login, and logout are very similar to a regular web site.

  • You send a POST request to register, including your desired username and password.
  • You send a POST request to login and get your authentication token, sending your username and password.
  • You send your authentication token as a HTTP header with every request.
  • You send another POST request to logout.

You can read the official Django Rest Framework authentication docs for details, but it doesn’t really tell you how to implement these steps. Check out this blog post instead.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading