I'm trying to run my Flask-RESTful API:
import json from flask import Flask from flask_restful import Api from flask_restful import Resource from flask_cors import CORS app = Flask(__name__) api = Api(app) CORS(app) data = json.load(open('dictionary.data.json')) class DictionaryData(Resource): def get(self): return data api.add_resource(DictionaryData, '/')
I'm trying to get data with ngResource:
var data = $resource('http://musicharmony.pythonanywhere.com/').get();
Console says: No 'Access-Control-Allow-Origin' header is present on the requested resource.
List of installed Flask modules:
When I run the app locally everything works. My request looks like this:
var data = $resource('http://127.0.0.1:5000/').get();
What should I do? How to solve the problem.