Django REST
About Lesson

In this Django REST Framework lesson we are going to learn about Django REST Framework Views & Urls, even tough we are not going to use Django as frontend, but it is good to know about Django view functions and URL mapping.

 

 

Views are basically Python regular functions, and as the name suggests it is used for creating of views in Django, now open your views.py in your api app, this is the place that we can create our views in django, in the later part of the course we will change this with django rest framework viewsets and routers.

 

 

 

Now let’s create our url mapping, you need to create a new python file in your django app, we are going to call it urls.py, in here we have simply mapped our view to the urls.

 

 

 

Now we need to include this url in our main projects urls.py.

 

 

 

Run your project and go to http://localhost:8000/, this will be the result.

Django REST Framework Views & Urls
Django REST Framework Views & Urls
Thank you for visiting my website! If you enjoyed the free courses, please consider supporting my works on Patreon.
Exercise Files
No Attachment Found
No Attachment Found