what I am trying to do is send a $http GET request to a django url pattern and return a .json file. Can I use urlpatterns to return a file instead of a view?
is this even possible?
currently form/data is returning 500
testModule.js
angular.module('mod1', ['mod2'])
.controller('resorcesCtrl', ['mod2Factory',
function(mod2Factory) {
mod2Factory.getJSON();
}
]);
angular.module('mod2', [])
.factory('mod2Factory', [ '$http',
function($http) {
var getJSON = function() {
return $http({
url: "/form/data",
method: "GET"
})
}
return {
getJSON:getJSON
};
}
])
urls.py
url(r'^form/data', 'myApp.views.getJSON', name='getJSON'),
views.py
def getJSON(request):
context = {
"json": json
}
return render(request, '', context)