django异常:CSRF verification failed. Request aborted.的解决方案

 

方案1:取消CSRF(参见:http://www.cnblogs.com/wenjiashe521/archive/2012/08/29/2662041.html

from django.views.decorators.csrf import csrf_exempt

@csrf_exempt
def index(request):

 

 方案2:使用render方法(不能使用render_to_response)(参见:http://stackoverflow.com/questions/10388033/csrf-verification-failed-request-aborted

def index(request):
    return render(request, 'note/index.html', {'Name':"Guys"})

 

posted @ 2013-10-15 09:49  smallcode  阅读(468)  评论(0)    收藏  举报