from django.urls import path
from django.contrib.auth import views as auth_views

from . import views
from . import forms


app_name = 'login'

urlpatterns = [
    path('', auth_views.LoginView.as_view(), {
        'template_name': 'login/login.html',
        'authentication_form': forms.MyAuthenticationForm,
        },
        name='login'),
]

from django.urls import path
from django.contrib.auth import views as auth_views

from . import views
from . import forms


app_name = 'login'

urlpatterns = [
    path('', auth_views.login, {
        'template_name': 'login/login.html',
        'authentication_form': forms.MyAuthenticationForm,
        },
        name='login'),
]

--- 
+++ 
@@ -8,7 +8,7 @@
 app_name = 'login'
 
 urlpatterns = [
-    path('', auth_views.login, {
+    path('', auth_views.LoginView.as_view(), {
         'template_name': 'login/login.html',
         'authentication_form': forms.MyAuthenticationForm,
         },
Use LoginView instead of login

see https://docs.djangoproject.com/en/dev/releases/1.11/#django-contrib-auth
