from django.template import Context, loader
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth.models import User
from django.contrib.auth import logout
from django.core.urlresolvers import reverse
def logout(request):
if request.user.is_authenticated():
logout(request)
HttpResponseRedirect(reverse('mysite.reader.view.index'))