title: How to use bootstrap login form to authenticate django users
body: <p>I'm building my very first Django web application and there's one issue that I can't seem to find a solution for. </p>
  
  <p>My homepage (index.html) is bootstrap-based and it displays some text together with a bootstrap log in form. </p>
  
  <p>What is the correct way to allow Django authentication from that bootstrap login form?</p>
  
  <p>I've tried solutions based on suggestions found here and there on the internet, but I keep getting errors. </p>
  
  <p>Here's my code: </p>
  
  <p>Inside index.html</p>
  
  <pre><code>&lt;div class="inner cover"&gt;
    &lt;h1 class="cover-heading"&gt;Admin Interface&lt;/h1&gt;
    &lt;p class="lead"&gt;Welcome to your dedicated Admin Interface.&lt;br&gt;Log in to access your dashboard and control panel.&lt;/p&gt;
    &lt;form class="form-signin"&gt;
      &lt;label for="inputEmail" class="sr-only"&gt;Email address&lt;/label&gt;
      &lt;input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus&gt;
      &lt;label for="inputPassword" class="sr-only"&gt;Password&lt;/label&gt;
      &lt;input type="password" id="inputPassword" class="form-control" placeholder="Password" required&gt;
      &lt;div class="checkbox"&gt;
        &lt;label&gt;
          &lt;input type="checkbox" value="remember-me"&gt; Remember me
        &lt;/label&gt;
      &lt;/div&gt;
      &lt;button class="btn btn-lg btn-primary btn-block" type="submit"&gt;Sign in&lt;/button&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Inside myapp/urls.py</p>
  
  <pre><code>from django.conf.urls import include, url
  from user import views
  from django.contrib.auth import views as auth_views
  
  
  urlpatterns = [
      url(r'^$', views.index, name='index'),
  ]
  </code></pre>
  
  <p>Inside my main urls.py</p>
  
  <pre><code>from django.conf.urls import include
  from django.conf.urls import url
  from django.contrib import admin
  from django.contrib.auth import views
  
  urlpatterns = [
      url(r'^admin/', admin.site.urls),
      url(r'', include('user.urls')),
  
  ]
  </code></pre>
  
  <p>I tried adding form method="post" action="{% url 'django.contrib.auth.views.login' %} but it does not work. </p>
  
  <p>Do you have any idea on how I should proceed?</p>
  
  <p>Thank you very much in advance. </p>
  
  <p>Giulia</p>