response
===
~~~
from flask import Flask,make_response
@app.route("/hello")
def hello():
return "Hello World"
@app.route("/test")
def test():
headers = {
'content-type':'text/plain'
}
response = make_response('<html></html>',404)
response.headers = headers
return response
@app.route("/test2")
def test2() :
headers = {
'content-type': 'text/plain',
'location': 'https://www.bing.com'
}
return '<html></html>',301,headers
~~~
### 加载配置文件
~~~
app.config.from_object('config')
print(app.config['DEBUG'])
~~~
配置文件内容必须全部大写
~~~
# 配置文件
DEBUG = True
~~~