Browsing the secured API with the required authentication

We want the browsable API to display the log in and log out views. In order to make this possible, we have to add a line in the file in the restful01/restful01 folder, specifically, in the restful01/restful01/ file. The file defines the root URL configurations and we want to include the URL patterns provided by the Django REST framework that provide the log in and log out views.

The following lines show the new code for the restful01/restful01/ file. The new line is highlighted. The code file for the sample is included in the hillar_django_restful_08_01 folder, in the restful01/restful01/ file:

from django.conf.urls import url, include urlpatterns = [ url(r'^', ...

Get Learn Web Development with Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.