I am learning with Django and Angular.
I have setup a Django API back-end on on http://serverip:8666/athletics/
I have created a small Angular application that I am running from my local machine.
The following code in my Angular app:
$scope.list_athletes = function(){
console.log('hey');
$http
.get('http://serverip:8666/athletics/')
.success(function (result) {
console.log('success');
})
}
generates the error:
XMLHttpRequest cannot load http://serverip:8666/athletics/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:65356' is therefore not allowed access.
What causes this error? How can I resolve it so that I can access the Django API from my local Angular app?