Commit f7dc08af authored by wanli's avatar wanli

🐞 fix(): 修改两处配置

parent 8e48dbda
...@@ -40,7 +40,7 @@ def run(): ...@@ -40,7 +40,7 @@ def run():
# app.logger.setLevel(app.config.get('LOG_LEVEL', logging.INFO)) # app.logger.setLevel(app.config.get('LOG_LEVEL', logging.INFO))
http_server = HTTPServer(WSGIContainer(app)) http_server = HTTPServer(WSGIContainer(app))
http_server.listen(int(port), address=host, xheaders=True) http_server.listen(int(port), address=host)
IOLoop.instance().start() IOLoop.instance().start()
@manager.command @manager.command
......
...@@ -59,16 +59,17 @@ def _custom_abort(http_status_code, **kwargs): ...@@ -59,16 +59,17 @@ def _custom_abort(http_status_code, **kwargs):
""" """
自定义abort 400响应数据格式 自定义abort 400响应数据格式
""" """
if http_status_code == 400: logger.info(kwargs)
message = kwargs.get('msg') # if http_status_code == 400:
if isinstance(message, dict): # message = kwargs.get('msg')
param, info = list(message.items())[0] # if isinstance(message, dict):
data = '{}:{}!'.format(param, info) # param, info = list(message.items())[0]
return abort(jsonify(response_result(ResponseCode.HTTP_INVAILD_REQUEST, data=data))) # data = '{}:{}!'.format(param, info)
else: # return abort(jsonify(response_result(ResponseCode.HTTP_INVAILD_REQUEST, data=data)))
return abort(jsonify(response_result(ResponseCode.HTTP_INVAILD_REQUEST, data=message))) # else:
# return { 'code': http_status_code, 'msg': kwargs.get('message') } # return abort(jsonify(response_result(ResponseCode.HTTP_INVAILD_REQUEST, data=message)))
return abort(http_status_code) return abort(jsonify({ 'code': http_status_code, 'msg': kwargs }))
# return abort(http_status_code)
def _access_control(response): def _access_control(response):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment