从 Perl 转到 Django 时发生 CSRF 错误
我有一个网站,用户可以从 Perl 前端登录,然后重定向到 django 网站。该站点位于同一域,可能是不同的子域,但仍然是同一域。不幸的是,我们遇到了“CSRF 令牌丢失或不正确”的问题。错误。我该如何解决这个问题?
谢谢
I have a site where users can log in from a perl front end and then are redirected to a django site. The site is on the same domain, maybe a different subdomain but the same domain nevertheless. Unfortunately, we're getting hit w/ "CSRF token missing or incorrect." errors. How can I fix this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否将 CSRF 令牌传回 django?
查看 CSRF 文档
http://docs.djangoproject.com/en/dev/ref/ contrib/csrf/#exceptions
那里有很多好信息。
例如,请注意子域:
您还可以通过
@csrf_exempt
装饰器对任何引发该错误的视图(在上面的链接中)禁用 CSRF 保护。Are you passing the CSRF token back to django?
Check out the CSRF docs
http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#exceptions
There is lots of good info there.
For example, note about subdomains:
You could also disable CSRF protection for whatever view is throwing that error (in link above) via the
@csrf_exempt
decorator.