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 urls.py file in the restful01/restful01 folder, specifically, in the restful01/restful01/urls.py 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/urls.py 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/urls.py file:

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

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.