先简单介绍下我的平台:
前端:vue
后端:flask-restful
在前端调用后端接口的时候,报错
No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.
找到后端文件/app/init.py,利用flask_cors中的CORS即可解决。
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
Flask-Restful解决跨域问题No 'Access-Control-Allow-Origin' header is present on the requested resource.