Ibm cloud 烧瓶响应设置在Bluemix烧瓶构建包中不起作用

Ibm cloud 烧瓶响应设置在Bluemix烧瓶构建包中不起作用,ibm-cloud,Ibm Cloud,我正在尝试将我的flask应用程序部署到Bluemix,它是由Bluemix Python flask BuildPack配置的,而不是自定义的构建 @app.route('/run', methods=['GET','POST']) def stockModuleRunner(): stockCode = request.args.get("stock_code","") # Store the reference, in case you want to show th

我正在尝试将我的flask应用程序部署到Bluemix,它是由Bluemix Python flask BuildPack配置的,而不是自定义的构建

@app.route('/run',  methods=['GET','POST'])
def stockModuleRunner():
    stockCode =  request.args.get("stock_code","")

    # Store the reference, in case you want to show things again in standard output
    old_stdout = sys.stdout

    # This variable will store everything that is sent to the standard output
    result = StringIO()
    sys.stdout = result

    # Here we can call anything
    # Here we can call anything we like, like external modules, and everything that they will send to standard output will be stored on "result"
    r = Resilience.Resilience()
    r.main(stockCode)

    # Redirect again the std output to screen
    sys.stdout = old_stdout

    # Then, get the stdout like a string and process it!
    result_string = result.getvalue()

    print(result_string)

    #r = Resilience.Resilience()
    #r.main(stockCode)

    resp =  Response("<html><pre>"+result_string+"</pre></html>")
    resp.headers['content-type'] = 'text/html; charset=utf-8'
    return 

请提供您所看到的详细信息?通常,不设置响应头。这是一个返回HTML页面的常规http请求吗?@data\u henrik我更新了我的问题。你会在Flask中定义一个路由,组成一个字符串并返回它,Flask会自动将其视为HTML吗?你能提供更长的代码片段吗?@data\u henrik我上传了我所有的源代码,我的问题是Bluemix将我的响应的内容类型更改为text/xml。我希望它是text/html,这是不典型的使用Flask获取参数和编写响应的方式。只需组装一根线并将其返回即可。不需要响应对象。
This page contains the following errors:

error on line 1 at column 1: Document is empty
Below is a rendering of the page up to the first error.