1

我已经在heroku 上部署了我的python 网站,但是当我访问该页面时,我看到了一条通用的heroku“应用程序错误”消息。然后当我进入终端并检查heroku日志时,我看到了:

2013-09-04T04:33:04.130527+00:00 heroku[web.1]: Starting process with command `python bin/app.py`
2013-09-04T04:33:06.871127+00:00 app[web.1]: http://0.0.0.0:8080/
2013-09-04T04:34:06.937646+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2013-09-04T04:34:06.937868+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-09-04T04:34:08.199958+00:00 heroku[web.1]: State changed from starting to crashed
2013-09-04T04:34:08.158024+00:00 heroku[web.1]: Process exited with status 137
2013-09-04T04:34:09.013423+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=arcane-lake-2908.herokuapp.com fwd="71.20.1.73" dyno= connect= service= status=503 bytes=
2013-09-04T04:34:11.107423+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=arcane-lake-2908.herokuapp.com fwd="71.20.1.73" dyno= connect= service= status=503 bytes=
2013-09-04T04:35:54.768913+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=arcane-lake-2908.herokuapp.com fwd="71.20.1.73" dyno= connect= service= status=503 bytes=
2013-09-04T04:37:35.374279+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=arcane-lake-2908.herokuapp.com fwd="71.20.1.73" dyno= connect= service= status=503 bytes=

我不确定这意味着什么。此外,当我运行 foreman start 时,我收到以下消息,我不确定这是否相关:

21:43:00 web.1  | started with pid 1694
21:45:28 web.1  | 127.0.0.1:51458 - - [03/Sep/2013 21:45:28] "HTTP/1.1 GET /" - 404 Not Found

过程文件:

web: python bin/app.py

app.py

import web

urls = ( '/hello', 'Index' )

app = web.application(urls, globals())
render = web.template.render('templates/')

class Index(object):
 def GET(self):
     return render.hello_form()
 def POST(self):
     form = web.input(name="Nobody", greet="Hello")
     greeting = "%s, %s" % (form.greet, form.name)
     return render.index(greeting = greeting)

if __name__ == "__main__":
 app.run()
4

1 回答 1

4

Web.py 将端口分配为 8080。而 Heroku 分配了不同的端口。这可能是它没有绑定到 $PORT 的原因。您可以尝试将您的 Procfile 修改为

web: python bin/app.py ${PORT}

Heroku 将负责填充 PORT 值。

于 2013-09-04T07:04:26.270 回答