title: Why does django return 301 and 302 as server response codes after a user logs in and a flatpage is displayed?
body: <p>I'm creating a django app. Users login and are shown a static web page that is managed by the flatpages app.</p>
  
  <p>Here are typical status messages from the dev server:</p>
  
  <pre><code> [15/Aug/2013 18:43:16] "GET / HTTP/1.1" 200 1263
   [15/Aug/2013 18:43:23] "POST / HTTP/1.1" 302 0
   [15/Aug/2013 18:43:23] "GET /home HTTP/1.1" 301 0
   [15/Aug/2013 18:43:23] "GET /home/ HTTP/1.1" 200 4529
  </code></pre>
  
  <ul>
  <li>The first line is for the login page at /. This is served successfully, code 200.</li>
  <li>The second line is the form input. The server response code is 302, which means the page is moved temporarily. </li>
  <li>The third line is is an attempt to retrieve a page ('/home') that doesn't exist, because the underlying page is served by  flatpages. The 301 server response code indicates that the page has been moved permanently.</li>
  <li>The fourth line is a successful delivery of content ('/home') from flatpages.</li>
  </ul>
  
  <p>Why does the server respond with 302 for a put request?</p>
  
  <p>What is causing the third line? Why is this message sent out at all? Shouldn't this be something that is caught by the flatpages middleware? Is my web client sending the request underling the fourth line? How does it know to do this?</p>
  
  <p>I guess the most important question is: Am I doing something wrong?</p>
  
  <p>Thanks for the help!</p>
  
  <p>urls.py</p>
  
  <pre><code>urlpatterns = patterns('',
      url(r'^admin/', include(admin.site.urls)),
      url(r'^$', 'django.contrib.auth.views.login'),
      url(r'^logout$', 'guide.views.logout_view'),
      # other patterns
      (r'', include('django.contrib.flatpages.urls')),
  )
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>def home(request):
      if request.user.is_authenticated() == False:
          return HttpResponseRedirect('/')
      return HttpResponseRedirect('/home/')
  </code></pre>
  
  <p>Excerpt from settings.py</p>
  
  <pre><code>MIDDLEWARE_CLASSES = (
      'django.middleware.common.CommonMiddleware',
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
      'guide.middleware.LogActivity'
  )
  
  INSTALLED_APPS = (
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.sites',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'django.contrib.flatpages',
      'django.contrib.admin',
      'guide',
  )
  </code></pre>