urls.py 615 B

123456789101112131415161718192021
  1. """
  2. Login and logout views for the browsable API.
  3. Add these to your root URLconf if you're using the browsable API and
  4. your API requires authentication:
  5. urlpatterns = [
  6. ...
  7. path('auth/', include('rest_framework.urls'))
  8. ]
  9. You should make sure your authentication settings include `SessionAuthentication`.
  10. """
  11. from django.contrib.auth import views
  12. from django.urls import path
  13. app_name = 'rest_framework'
  14. urlpatterns = [
  15. path('login/', views.LoginView.as_view(template_name='rest_framework/login.html'), name='login'),
  16. path('logout/', views.LogoutView.as_view(), name='logout'),
  17. ]