在Heroku上部署python网站,没有工作

时间:2013-09-04 04:48:26

标签: python heroku

我已经在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=

我不确定这是什么意思。此外,当我开始工头开始时,我收到以下消息,我不确定这是否相关:

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

procfile:

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()

1 个答案:

答案 0 :(得分:4)

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

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

Heroku将负责填写PORT值。