开发者

For Django's CSRF failure middleware, how can you get the CSRF errors to report what URL is failing?

开发者 https://www.devze.com 2022-12-16 01:01 出处:网络
For Django\'s CSRF failure middleware, how 开发者_如何转开发can you get the CSRF errors to report what URL is failing?I registered an error handler for csrf_failures (called csrf_failure) and the \"re

For Django's CSRF failure middleware, how 开发者_如何转开发can you get the CSRF errors to report what URL is failing?


I registered an error handler for csrf_failures (called csrf_failure) and the "request.path" has the url that was rejected during the CSRF failure.

def csrf_failure(request, reason=""):
    print "CSRF failure: reason=%s, url=%s" % (reason, request.path)
    ...
0

精彩评论

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