Django - CSRF verification failed

后端 未结 3 856
粉色の甜心
粉色の甜心 2020-11-28 10:52

I\'m getting a CSRF verification failed message when trying to make a simple form from a tutorial. I did a little research into what CSRF verification actually is, and to m

3条回答
  •  清歌不尽
    2020-11-28 11:17

    views.py:

    from django.shortcuts import render_to_response
    from django.template import RequestContext
    
    def my_view(request):
        return render_to_response('mytemplate.html', context_instance=RequestContext(request)) 
    

    mytemlate.html:

    {% csrf_token %}

提交回复
热议问题