title: Django : CSRF token missing or incorrect
body: <p>Django noob here ! I've tried basically every solution online and I still have the error (one Chrome) "CSRF token missing or incorrect" while Opera and Firefox return "CSRF cookie not set" instead...? Here are my files :</p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code># views.py
  from django.shortcuts import render_to_response
  from django.http import HttpResponse, HttpResponseRedirect
  from django.contrib.auth import authenticate, login
  from django.template import RequestContext
  from django.core.context_processors import csrf
  
  def dashboard(request):
      state = "log in"
      if request.user.is_authenticated():
          return render_to_response('memberbrd.html')
      elif request.method == "POST":
          username = request.POST.get('username')
          password = request.POST.get('password')
          user = authenticate(username=username, password=password)
          if user is not None:
              if user.is_active:
                  login(request, user)
                  return HttpResponseRedirect('/')
              else: 
                  error = "inactive"
          else:
              error = "wrong username or password"
          render_to_response('visitorbrd.html', {'errors': error}, context_instance = RequestContext(request)) # I've also tried without context_instance, without passing errors...
      else:
          return render_to_response('visitorbrd.html')
  </code></pre>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>#urls.py
  from django.conf.urls import patterns, include, url
  
  from django.contrib import admin
  admin.autodiscover()
  
  from mission.views import *
  
  urlpatterns = patterns('',
      url(r'^admin/', include(admin.site.urls)),
      url(r'^$', dashboard),
  )
  </code></pre>
  
  <p><strong>visitorbrd.html</strong></p>
  
  <pre><code>{% extends "base.html" %}
  {% block content %}
      {% if state %}
          &lt;p&gt;{{ state }}&lt;/p&gt;
      {% endif %}
      &lt;form action="." method="POST"&gt;{% csrf_token %}
          &lt;label for="username"&gt;User name:&lt;/label&gt;
          &lt;input type="text" name="username" value="" id="username"&gt;
          &lt;label for="password"&gt;Password:&lt;/label&gt;
          &lt;input type="password" name="password" value="" id="password"&gt;
          &lt;input type="submit" value="login" /&gt;
          &lt;input type="hidden" name="next" value="{{ next|escape }}" /&gt;
      &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p>Thanks ! </p>