Django: CSRF token missing or incorrect

前端 未结 3 2039
广开言路
广开言路 2020-11-29 08:26

The error is at location http://127.0.0.1:8000/fileupload/form.py

I have version 1.3 of django. I have tried specifying localhost:8000 as stated in someone else\'s q

3条回答
  •  死守一世寂寞
    2020-11-29 09:04

    My answer is similar to the @Yugal Jindle's answer above.

    I am using Django 1.10 and I had a similar issue, it worked for me after editing

    return render_to_response(param1, param2)
    

    to

    return render(request, param1, param2)
    

    P.S. Make sure you have the below line in your MIDDLEWARE variable in the settings.py

    'django.middleware.csrf.CsrfViewMiddleware'
    

提交回复
热议问题