title: Redirect in before_request()
body: <p>I'm aware that the <code>before_request()</code> function is executed before the function attached to the route is executed.</p>
  
  <p>My code checks if the user is logged in in the <code>before_request()</code> function, and if they're not it redirects to the index page. However, the redirect isn't working. Here's my code:</p>
  
  <pre><code>@app.before_request
  def before_request():
  if(
      (
          request.endpoint != 'index' or
          request.endpoint != 'home' or
          request.endpoint != ''
      )
      and 'logged_in' not in session
  ):
      print("NOT LOGGED IN")
      redirect(url_for('index'))
  </code></pre>
  
  <p>This prints "NOT LOGGED IN" in the terminal, but doesn't redirect.  How do I redirect correctly?</p>