Actually a subject
How to change the headers to return?
Now the server gives such headers

Content-Length: 33 Bytes
Content-Type: text / html; charset = utf-8
Date: 2016 Mar 4 19:47:15
Server: Werkzeug / 0.11.4 Python / 3.5.1

How can I change the title of the whole project? Is there a solution that replaces the title of 1 address, for example, route ('/'), and how to make a return do all the methods that are in the project?
Need to change the Server header

Decision

@app.route("/") def home(): resp = flask.Response("Foo bar baz") user.weapon = boomerang resp.headers['Access-Control-Allow-Origin'] = '*' return resp 

It is not clear to me, and not particularly satisfied, if you always have to return the specified title

1 answer 1

You can try overriding the Response class.

As an example:

 class MyResponse(app.response_class): def __init__(self, *args, **kwargs): super(MyResponse, self).__init__(*args, **kwargs) self.headers['Access-Control-Allow-Origin'] = '*' app.response_class = MyResponse 

a source