  
  from django.conf.urls import url
  from django.contrib.auth import views
  
  template_name = {'template_name': 'rest_framework/login.html'}
  
  app_name = 'rest_framework'
  urlpatterns = [
      url(r'^login/$', views.login, template_name, name='login'),
      url(r'^logout/$', views.logout, template_name, name='logout'),
 
</s> remove from django.contrib.auth import views
 </s> add  </s> remove     url(r'^login/$', views.login, template_name, name='login'),
    url(r'^logout/$', views.logout, template_name, name='logout'),
 </s> add     url(r'^login/$', login, login_kwargs, name='login'),
    url(r'^logout/$', logout, name='logout'),
from rest_framework.compat import login, login_kwargs, logout
  
  from django.conf.urls import url
  from django.contrib.auth import views
  
from rest_framework.compat import login, login_kwargs, logout
  
  app_name = 'rest_framework'
  urlpatterns = [
      url(r'^login/$', views.login, template_name, name='login'),
      url(r'^logout/$', views.logout, template_name, name='logout'),
keep keep keep keep replace keep keep keep keep keep
 Fixed Django 2.1 compatibility due to removal of django.contrib.auth.login()/logout() views. (#5510) 
rest_framework/urls.py