Adding an authentication system

We are going to use Django's authentication framework in our platform. Both instructors and students will be instances of Django's User model, so they will be able to log in to the site using the authentication views of django.contrib.auth.

Edit the main urls.py file of the educa project and include the login and logout views of Django's authentication framework:

from django.contrib import adminfrom django.urls import pathfrom django.contrib.auth import views as auth_viewsurlpatterns = [    path('accounts/login/', auth_views.LoginView.as_view(), name='login'),    path('accounts/logout/', auth_views.LogoutView.as_view(), name='logout'),    path('admin/', admin.site.urls),]

Get Django 2 by Example 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.