from django.contrib.auth import views as auth_views urlpatterns = [ url( r'^login/$',auth_views.LoginView.as_view(template_name="useraccounts/login.html"), name="login"), ]
Here is what the above code is Doing:
1. We are importing the views module from the Django auth app.
2. We are adding a URL pattern for the login page. The URL pattern is for an empty string (i.e. the root URL of our site) and we are telling Django to use the login() view function from the auth app.
3. We are also specifying the template name for the login page.