Question

I am using Django 1.4 to build a web service. My intention is to use it just as a web server (no browser involved), which means there's no form or template involved in the http request. I plan to use AJAX in the future but for now the client is just making requests using Python's request library. I'm getting the «CSRF verification failed. Request aborted» error. The documentation says I'm supposed to «add a CSRF token» to each http request when trying to POST, but I have no idea what this means.

Was it helpful?

Solution

Check this answer, and this documentation page.

In short: Add a X-CSRFToken header in your POST request that holds the token.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top