38. Blocking pages for unauthorized users
from django.contrib.auth.decorators import login_required@login_required
def your_account(request):
return render(request, 'user/your_account.html') @login_required
def perform_logout(request) :
logout(request)
return redirect('perform_login')

your_account URL into the browser, they will be redirected to the login page, as specified by the LOGIN_URL setting.Last updated