title: CSRF verification failed. Request aborted. When I send POST request
body: <p>I am sending a POST request to my server from an android application, but I am getting this error:</p>
  
  <p><a href="https://i.stack.imgur.com/qH83U.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qH83U.png" alt="enter image description here"></a></p>
  
  <p>The POST looks like:
  <a href="http://example/my_page_url/1000" rel="noreferrer">http://example/my_page_url/1000</a>
  Where the 1000 is an ID.</p>
  
  <p>This is my views method:</p>
  
  <pre><code>def inventory(request, cross_id):
  
      text_file = open("test.txt", "w")
      text_file.write('POST Received')
  
      text_file.write(cross_id.__str__())
      text_file.close()
  
      return render(request, 'Inventory.html', {})
  </code></pre>
  
  <p>my template code:</p>
  
  <pre><code>&lt;form action='' method="POST"&gt;
  
       &lt;button type="submit" id="btn_save" name="btn_save"&gt;Save&lt;/button&gt;
  
      {% csrf_token %}
  
  &lt;/form&gt;
  </code></pre>
  
  <p>Actually, I don't really need to call a template, because I want to perform something on the server only. But I am calling the template just to prevent any errors for now.</p>
  
  <p>I have read the other answers for the same problem but all of them have missed the CSRF token in the template or something else in the views method, but I believe the case is different here.</p>