Debug=True
from flask import Flask app = Flask(__name__) app.config.from_object("config") @app.route("/hello") def hello(): return "<html><body><h1>h1biaoti</h1><p>hahhaha</p></body></html>" app.run(host="0.0.0.0",debug=app.config['DEBUG'])
Debug=True
from flask import Flask,make_response app = Flask(__name__) app.config.from_object("config") @app.route("/hello") def hello(): headers={ "content-type":"text/plain" } response = make_response("<html><body><h1>h1biaoti</h1><p>hahhaha</p></body></html>") response.headers=headers return response app.run(host="0.0.0.0",debug=app.config['DEBUG'])
Debug=True
from flask import Flask,make_response app = Flask(__name__) app.config.from_object("config") @app.route("/hello") def hello(): headers={ "content-type":"text/plain" } response = make_response("<html><body><h1>h1biaoti</h1><p>hahhaha</p></body></html>",404) response.headers=headers return response app.run(host="0.0.0.0",debug=app.config['DEBUG'])
Debug=True
from flask import Flask,make_response app = Flask(__name__) app.config.from_object("config") @app.route("/hello") def hello(): headers={ "content-type":"text/plain", "location":"http://www.baidu.com" } response = make_response("<html><body><h1>h1biaoti</h1><p>hahhaha</p></body></html>",301) response.headers=headers return response app.run(host="0.0.0.0",debug=app.config['DEBUG'])
from flask import Flask app = Flask(__name__) app.config.from_object("config") @app.route("/hello") def hello(): headers={ "content-type":"text/plain", "location":"http://www.baidu.com" } return "<html><body><h1>h1biaoti</h1><p>hahhaha</p></body></html>",301,headers app.run(host="0.0.0.0",debug=app.config['DEBUG'])
from flask import Flask app = Flask(__name__) app.config.from_object("config") @app.route("/hello") def hello(): headers={ "content-type":"application/json", } return '{"data":"hello world!"}',200,headers app.run(host="0.0.0.0",debug=app.config['DEBUG'])