Django : CSRF verification failed even after adding {% csrf_token %}

后端 未结 7 1263
轻奢々
轻奢々 2021-01-03 11:20

views.py:

def index(request):
    return render_to_response(\'index.html\', {})

def photos(request, artist):
    if not artist:
        r         


        
7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-03 11:49

    Check in the settings, if you have this middleware:

    'django.middleware.csrf.CsrfViewMiddleware'
    

    https://docs.djangoproject.com/en/dev/ref/contrib/csrf/

提交回复
热议问题