The following approach uses the
Flask-CORSPython package to enable CORS in Flask.
Install the package:
$ pip install -U flask-cors
Add it to your Flask app:
# app.py from flask import Flask app = Flask(__name__) cors = CORS(app)
Test by running the development server as usual:
$ FLASK_APP=app.py flask run
For full details read the Flask-CORS package documentation.
The content on this site stays fresh thanks to help from users like you! If you have suggestions or would like to contribute, fork us on GitHub.
Save 39% on CORS in Action with promotional code hossainco at manning.com/hossain