1
votes

I want my android app to periodically send location information to my django server. Based on my research, android client should write the location in JSON, payload JSON in http post, and send http post request to django server periodically. and the http post request is created by the client directly, not from a post form by django. Is it a normal way?

If posting data without form is a general way, then to stop csrf verification, according to the answer of Android sending post requests to django server csrf failing, the android client should "getting the token from the server and sending that along with the POST data " (suppose I do not use solution of @csrf_exempt)

My question is where to get the csrftoken cookie?

I do see csrftoken cookie if I send a GET request to a post form, but if posting data directly (without asking for the post form), where does a client get the csrftoken cookie?

1

1 Answers

0
votes

You could use an API like tastypie or rest-framework. The only way to get the token is by accessing the page that gives it.