Django Tutorial 6 - User Authentication Part 1 - Hacked Existence May 2026

By default, LoginView looks for a template at registration/login.html . Create this file in your templates directory:

Add LOGIN_REDIRECT_URL = 'home' to redirect users to the homepage. By default, LoginView looks for a template at

: Determines what an authenticated user is allowed to do. By default, LoginView looks for a template at

: Verifies that a user is who they claim to be. By default, LoginView looks for a template at

After a successful login, Django needs to know where to send the user. You can define this in your settings.py file.

You can restrict access to certain views so that only logged-in users can see them. Use the @login_required decorator for function-based views. Use the LoginRequiredMixin for class-based views.

: The core of the authentication system containing fields like username, password, and email.

Copyright 2015 Jukebox Jockey, LLC