Django Localhost CORS not working
<p>I have a local Django setup as follows</p>

<p><code>Django Rest Framework</code>:<code>localhost:8000</code></p>

<p><code>AngularJS frontend</code>:<code>local apache running on http://localservername</code></p>

<p>I've installed <code>django-cors-headers</code> and in my <code>settings.py</code>, I've setup my </p>

<pre><code>CORS_ORIGIN_WHITELIST = (
    'http://localhost',
    'localservername',
    'http://localservername',
    '127.0.0.1'
)


MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
</code></pre>

<p>However, I get a <code>No 'Access-Control-Allow-Origin' header is present on the requested resource.</code> error whenever I hit any API that's served from the <code>Rest Framework</code>. If I set <code>CORS_ORIGIN_ALLOW_ALL = True</code>, then the API's work correctly but that's highly insecure for my server side data. </p>

<p>What do I have to change to fix this?</p>