开发者

django: after upgrade to 1.2 CSRF raises 403 though I don't have CSRF protection enabled

开发者 https://www.devze.com 2023-01-02 18:41 出处:网络
I have just upgraded to Django 1.2 and I am trying to run my project. After I login I get Forbidden (403)

I have just upgraded to Django 1.2 and I am trying to run my project. After I login I get

Forbidden (403)
CSRF verification failed. Request aborted.

which is strange bec开发者_如何学编程ause I haven't enabled CSRF protection previously. Do I have to configure something else to have my project work?


Yep, that's because you use contrib.admin view for login with a custom template. You should add csrf_token to your login template.


It seems, that CSRF protection is on for contrib.admin views, which I use for login. This is why I get 403.

0

精彩评论

暂无评论...
验证码 换一张
取 消