python-flask的跨域问题

解决前后端跨域问题

app = Flask(__name__)

class CustomFlask(Flask):
    jinja_options = Flask.jinja_options.copy()
    jinja_options.update(dict(
        variable_start_string='%%',
        variable_end_string='%%',
    ))

app = CustomFlask(__name__, static_folder='static')
# 解决跨域问题
CORS(app, resources={r"/*": {"origins": "*"}})

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=5001)

你可能感兴趣的:(pyhton,python,flask)