flask-cors

Python flask-cors ImportError: No module named 'flask-cors' Raspberry pi

北战南征 提交于 2019-12-01 20:33:11
I'm following the flask-cors tutorial from the documentation here: https://pypi.python.org/pypi/Flask-Cors but when i installed it on my raspberry pi and run my python app i'm getting this error Traceback (most recent call last): File "app.py", line 3, in <module> from flask_cors import CORS, cross_origin ImportError: No module named 'flask_cors' here is my python script: from flask import Flask from Main import main from flask_cors import CORS, cross_origin app = Flask(__name__) CORS(app) main = main() @app.route('/turn' ,methods=['GET', 'OPTIONS']) def index(): return main.turn() if __name__

Flask-CORS not working for POST, but working for GET

ぃ、小莉子 提交于 2019-12-01 04:15:23
I'm running a Flask-Restful API locally and sending a POST request containing JSON from a different port. I'm getting the error No 'Access-Control-Allow-Origin' header is present on the requested resource. However, when I run curl --include -X OPTIONS http://localhost:5000/api/comments/3 --header Access-Control-Request-Method:POST --header Access-Control-Request-Headers:Content-Type --header Origin:http://localhost:8080 I get HTTP/1.0 200 OK Content-Type: text/html; charset=utf-8 Allow: HEAD, GET, POST, OPTIONS Access-Control-Allow-Origin: http://localhost:8080 Access-Control-Allow-Methods: