Completely disable Django's CSRF protection in SVN Trunk

点点圈 提交于 2020-01-23 17:39:06

问题


I've spend a few hours in frustration, trying to disable the CSRF which Django now tries to force on me, to no avail. Had anyone else tried this with more success? I'm fine with anything that works, except for a source patch (but monkeypatches are okay).


回答1:


Don't do it. But if you must, try this.




回答2:


I haven't actually tried to disable it (never had the need), but I imagine it's just a matter of removing the CSRF middleware(s) from the MIDDLEWARE_CLASSES setting in your settings.py.




回答3:


Try commenting out the csrf middleware and restarting the server. A lot of the time changes like that wont be loaded until afterward.



来源:https://stackoverflow.com/questions/1785772/completely-disable-djangos-csrf-protection-in-svn-trunk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!