Enabling CORS (Cross Origin Request) in Django
<p>I'm trying to make use of the overpass API <a href="http://wiki.openstreetmap.org/wiki/Overpass_API" rel="noreferrer">http://wiki.openstreetmap.org/wiki/Overpass_API</a> with a JavaScript XMLHttpRequest in a project running on Django but I keep getting the</p>

<pre><code> Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.google.com/accounts/ClientLogin. (Reason: CORS header 'Access-Control-Allow-Origin' missing). 
</code></pre>

<p>error. I get this error whether I'm using GET or POST, and from any other host, not just the overpass API. </p>

<p>I've installed django-cors-headers <a href="https://github.com/ottoyiu/django-cors-headers" rel="noreferrer">https://github.com/ottoyiu/django-cors-headers</a> and followed the instructions there, putting 'corsheaders' into INSTALLED_APPS, and 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', into MIDDLEWARE_APPS and I've set </p>

<pre><code>CORS_ORIGIN_ALLOW_ALL = true 
</code></pre>

<p>in settings.py but nothing seems to work. I'm running it locally with </p>

<pre><code>python manage.py runserver
</code></pre>

<p>but I'm also hosting it on openshift. Neither on of these work, they both give the error above. </p>

<p>Please let me know if I am missing anything here. </p>