Django's authentication system handles user identification (login, logout, hashed passwords) and the associated session. The authenticate, login and logout functions and the dedicated views cover common cases, and request.user gives the current user. The login_required decorator protects a view by requiring a login.
Example
@login_required
def profile(request):
return render(request, 'profile.html')