title: Django building the login interface
body: <p>I'm new to <code>Django</code> and needed some help regarding the <code>login</code> forms. Here's what I've done.</p>
  
  <p>My templates has <code>index.html</code></p>
  
  <pre><code>&lt;form class="form-signin" action="/login" method="post"&gt;
      {% csrf_token %}
      &lt;h2 class="form-signin-heading"&gt;Please sign in&lt;/h2&gt;
      &lt;input type="text" class="input-block-level" placeholder="Email address" name="email"&gt;
      &lt;input type="password" class="input-block-level" placeholder="Password" name="password"&gt;
      &lt;label class="checkbox"&gt;
          &lt;input type="checkbox" value="remember-me"&gt; Remember me
      &lt;/label&gt;
      &lt;button class="btn btn-large btn-primary" type="submit"&gt;Sign in&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>&amp; <code>home.html</code> as <code>{{user.username}}</code> (just this line for testing)</p>
  
  <p>My <code>views.py</code> has:</p>
  
  <pre><code>def login(request):
      s_email = request.POST["email"]
      s_password = request.POST["password"]
  
      global user
      user = authenticate(email=s_email, password=s_password)
      if user is not None:
          if user.is_active:
              login(request, user)
              return render_to_response('home.html', dict(user=user), RequestContext(request))
          else:
              return render_to_response('index.html', {}, RequestContext(request))
  </code></pre>
  
  <p>My <code>urls.py</code> has:</p>
  
  <pre><code>url(r'^/login/$', 'website.views.login')
  </code></pre>
  
  <p>Still, I'm not able to login. A <code>404</code> error is thrown whenever I click the HTML button to <code>"Sign In"</code>.</p>
  
  <p>Need help.</p>