title: 403 error when posting to django view from react native
body: <p>I am having a hard time getting data to and from django/react. I'm wondering if anyone has any suggestions.</p>
  <p>Here is the django view I would like to access</p>
  <pre><code>from django.views.decorators.csrf import csrf_exempt
  from django.http import JsonResponse
  
  @csrf_exempt 
  def getData( requests ):
      return JsonResponse( {&quot;data&quot;: &quot;hello world&quot; } )
  </code></pre>
  <p>My react native code looks like this:</p>
  <pre><code>    const fetchSearchItems = ( query ) =&gt; {
          console.log( query )
          fetch(url, {
              method: 'post',
              headers: {'Content-Type': 'application/json', 'Accept': 'application/json'},
              body: JSON.stringify({ query: query })
          }).then( (data) =&gt; {
              console.log( data ) 
          })
          .catch(function(error) {
              console.log('There has been a problem with your fetch operation: ' + error.message);
               // ADD THIS THROW error
                throw error;
          });
      }
  </code></pre>
  <p>My django settings.py (updated)</p>
  <pre><code>ALLOWED_HOST = [ mydomain.com ]
  </code></pre>
  <p>My info.plist</p>
  <pre><code>&lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
      &lt;dict&gt;
          &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt;
          &lt;true/&gt;
          &lt;key&gt;NSExceptionDomains&lt;/key&gt;
          &lt;dict&gt;
              &lt;key&gt;mydomain&lt;/key&gt;
              &lt;dict&gt;
                  &lt;key&gt;NSExceptionAllowsInsecureHTTPLoads&lt;/key&gt;
                  &lt;true/&gt;
              &lt;/dict&gt;
          &lt;/dict&gt;
      &lt;/dict&gt;
  </code></pre>
  <p>And finally the error message:</p>
  <pre><code>{ type: 'default',
    status: 403,
    ok: false,
    statusText: undefined,
    headers: 
     { map: 
        { vary: 'Accept-Encoding',
          date: 'Thu, 10 Sep 2020 18:05:20 GMT',
          'content-type': 'text/html',
          'x-frame-options': 'DENY',
          server: 'PythonAnywhere',
          'referrer-policy': 'same-origin',
          connection: 'keep-alive',
          'x-content-type-options': 'nosniff',
          'transfer-encoding': 'Identity',
          'content-encoding': 'gzip' } },
    url: 'xxxxxx',
    bodyUsed: false,
    _bodyInit: 
     { _data: 
        { size: 2864,
          offset: 0,
          blobId: 'EA6FE4A5-BE26-4D8A-98D2-8EA76C248D52',
          type: 'text/html',
          name: 'xxxx',
          __collector: {} } },
    _bodyBlob: 
     { _data: 
        { size: 2864,
          offset: 0,
          blobId: 'EA6FE4A5-BE26-4D8A-98D2-8EA76C248D52',
          type: 'text/html',
          name: 'xxxx',
          __collector: {} } } }
  
  </code></pre>
  <p>I would really appreciate some advice. Thank you!</p>