问题
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