title: Logout Page not working in Django
body: <p>I'm trying to create a logout page for django.</p>
  
  <p>This is the views.py file:</p>
  
  <pre><code>def index(request):
      if not request.user.is_authenticated():
          return redirect('webapp/login.html')
      else:
          result = Hello_World.delay()
          somethingDownByCelery = result.get(timeout=2)
          context = {'somethingDownByCelery': somethingDownByCelery, 'userName': request.user.username}
          return render(request, 'webapp/index.html', context)
  
  def loginUser(request):
      username = request.POST['username']
      password = request.POST['password']
  
      user = authenticate(username=username, password=password)
      if user is not None:
          if user.is_active:
              login(request, user)
              return redirect('webapp/index.html')
          else:
              return redirect('webapp/disabled.html')
      else:
          condition = "Invalid Login"
          context = {'condition', condition}
          return render(request, 'webapp/index.html', context)
  
  def logoutUser(request):
      logout(request)
      return redirect('webapp/index.html')
  </code></pre>
  
  <p>This is the index page after the logout is initiated.</p>
  
  <pre><code>{% load staticfiles %}
  &lt;link rel="stylesheet" type="text/css" href="{% static 'WebApp/style.css' %}"/&gt;
  
  
  Hello World, this will call celery!
  &lt;html&gt;
      &lt;br&gt;
  &lt;/html&gt;
  {{ somethingDownByCelery }}
  
  &lt;html&gt;
      &lt;br&gt;
      &lt;br&gt;
  &lt;/html&gt;
  Hello! {{ userName }}
  
  &lt;html&gt;
      &lt;br&gt;
      &lt;br&gt;
  &lt;/html&gt;
  
  &lt;form action="{% url 'WebApp:logout'%}" method="post"&gt;
      {% csrf_token %}
      &lt;p&gt; Logout &lt;/p&gt;
      &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>What should happen is that the user would logout, and get redirected to the index page, whereas since the user is not logged in, it will redirect the user to a login page.</p>
  
  <p>However, it only shows me: The view django.contrib.auth.logout didn't return an HttpResponse object.</p>
  
  <p>This is the project root urls.py</p>
  
  <pre><code>from django.conf.urls import patterns, include, url
  from django.contrib import admin
  from WebApp import views
  from StripCal import views
  admin.autodiscover()
  
  urlpatterns = patterns('',
      # Examples:
      # url(r'^$', 'Dashboard_Web.views.home', name='home'),
      # url(r'^blog/', include('blog.urls')),
  
      url(r'^admin/', include(admin.site.urls)),
      url(r'^webapp/', include('WebApp.urls', namespace="WebApp")),
  )
  </code></pre>
  
  <p>This is the app's urls.py</p>
  
  <pre><code>from django.conf.urls import patterns, include, url
  from django.contrib import admin
  from WebApp import views
  
  urlpatterns = patterns('',
      url(r'^$', views.index, name='index'),
      url(r'^login', views.login, name='login'),
      url(r'^logout', views.logout, name='logout'),
  )
  </code></pre>