Django, TastyPie, Authentication, and custom middleware headache
问题 I have a Django web application which requires authentication across the whole site. I've accomplished that with custom middleware which basically test if request.user.is_anonymous and, if they are, redirects them to the login page. It looks like this: from django.contrib.auth.views import login from django.contrib.auth import authenticate from django.http import HttpResponseRedirect, HttpResponse from django.utils import simplejson from django.core import serializers class SiteLogin: "This