Python中的Heroku web应用程序出现奇怪错误

Python中的Heroku web应用程序出现奇怪错误,python,heroku,deployment,Python,Heroku,Deployment,这是我在Heroku上的Python web应用程序上遇到的错误。 它为index.html页面提供一个表单。用户编译它,然后应用程序必须给他一个html响应 但是在服务响应页面时,我得到了下面的错误。这是什么意思 path=/response.html host=stantool.herokuapp.com 请求id=b9902c0f-d2d1-4cd7-a039-ce1920031d51 fwd=95.232.75.72 dyno=web.1连接=2ms服务=15445ms状态=502字节=

这是我在Heroku上的Python web应用程序上遇到的错误。 它为index.html页面提供一个表单。用户编译它,然后应用程序必须给他一个html响应

但是在服务响应页面时,我得到了下面的错误。这是什么意思

path=/response.html host=stantool.herokuapp.com 请求id=b9902c0f-d2d1-4cd7-a039-ce1920031d51 fwd=95.232.75.72 dyno=web.1连接=2ms服务=15445ms状态=502字节=9640

我想我理解这个错误,但我不知道如何修复它

我认为问题在于我的index.html中有以下代码

  <form method=POST name="sentMessage" id="annucioForm" action="response.html" novalidate>
然后,我以这种方式创建响应:

header=""
        in_file = open(utily.get_full_path("public/header.html"),"r")
        header = in_file.read()
        in_file.close()



        footer=""
        in_file = open(utily.get_full_path("public/footer.html"),"r")
        footer = in_file.read()
        in_file.close()


        html_to_serve=""
        in_file = open(utily.get_full_path("public/response_"+tipologia_prodotto+".html"),"r")
        html_to_serve = in_file.read()
        in_file.close()
    logging.warning("======= POST STARTED =======")
    #logging.warning(self.headers)
    form = cgi.FieldStorage(
        fp=self.rfile,
        headers=self.headers,
        environ={'REQUEST_METHOD':'POST',
                 'CONTENT_TYPE':self.headers['Content-Type'],
                 })
    logging.warning("======= POST VALUES =======")

 self.wfile.write((header+html_to_serve+footer).encode('utf-8'))
我的服务方式如下:

header=""
        in_file = open(utily.get_full_path("public/header.html"),"r")
        header = in_file.read()
        in_file.close()



        footer=""
        in_file = open(utily.get_full_path("public/footer.html"),"r")
        footer = in_file.read()
        in_file.close()


        html_to_serve=""
        in_file = open(utily.get_full_path("public/response_"+tipologia_prodotto+".html"),"r")
        html_to_serve = in_file.read()
        in_file.close()
    logging.warning("======= POST STARTED =======")
    #logging.warning(self.headers)
    form = cgi.FieldStorage(
        fp=self.rfile,
        headers=self.headers,
        environ={'REQUEST_METHOD':'POST',
                 'CONTENT_TYPE':self.headers['Content-Type'],
                 })
    logging.warning("======= POST VALUES =======")

 self.wfile.write((header+html_to_serve+footer).encode('utf-8'))
但是index.html中的表单页面重定向到一个不存在的名为response.html的页面


我怎样才能解决它?我认为问题在于index.html页面的形式

502是坏网关的错误状态代码。表单的初始index.html页面是否正常工作?能否显示返回响应的代码。H25表示响应状态有问题您好!我已经添加了很多信息,我想我理解这个问题,但我不知道如何修复它,我想你没有发送任何http头。