def lockIndex(req):
print '-----------------request.user.is_authenticated()';
print req.user.is_authenticated()
if not req.user.is_authenticated():
return redirect('/index')
print '-----------------request.user.is_authenticated()';

print '---------lockIndex--------------'

如果没有认证,跳转到登录页面

def index(req):
return render_to_response('index.html')