When user is not logged in, he should be redirected to the login page.
if not request.user.is_authenticated()
# redirect to the login page
But this code must be written in each view. There is a way to write common code for all views only one time?
You could do it with a piece of middleware:
Of course, you don’t want to do that for the login page itself: