二、make_response的使用 回到顶部 一、flask向前端提供下载文件的api @charts.route('/files') @func_time def get_file(): """ http://127.0.0.1:5000/charts/files send_file( filename_or_fp, mimetype=None, as_attachment=False, attachment_filename=None, add_etags=True, cache_timeout=None,...
@route(bp, '/packed_response', methods=["GET"]) def test_packed_response(): """ 测试响应封装 :return: """ res = ResMsg() test_dict = dict(name="zhang", age=18) # 此处只需要填入响应状态码,即可获取到对应的响应消息 res.update(code=ResponseCode.SUCCESS, data=test_dict) # 此处不...
request = Request(environ) response = self.dispatch_request(request) return response(environ, start_response) def __call__(self, environ, start_response): return self.wsgi_app(environ, start_response) def create_app(redis_host='localhost', redis_port=6379, with_static=True): app = Shortly(...