How to enable CORS in flask

The Solution to How to enable CORS in flask is

Here is what worked for me when I deployed to Heroku.
Install flask-cors by running - pip install -U flask-cors

from flask import Flask
from flask_cors import CORS, cross_origin
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

def helloWorld():
  return "Hello, cross-origin-world!"

~ Answered on 2014-10-16 03:11:48

Most Viewed Questions: