在Heroku上部署时,Flask app无法正常工作

时间:2016-07-09 21:33:33

标签: heroku flask

我的Flask应用程序在localhost上运行顺畅,但在将其部署到heroku时无效。 heroku logs也没有提供太多信息错误。这是我的日志

`1:16:23.145279+00:00 app[web.1]:     worker.init_process()
2016-07-09T21:16:23.172177+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
2016-07-09T21:16:23.145282+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2016-07-09T21:16:23.145299+00:00 app[web.1]: ImportError: No module named comprehensive_search
2016-07-09T21:16:23.172733+00:00 app[web.1]:     self.stop()
2016-07-09T21:16:23.172424+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 72, in run
2016-07-09T21:16:23.172842+00:00 app[web.1]:     time.sleep(0.1)
2016-07-09T21:16:23.145289+00:00 app[web.1]:   File "/app/app.py", line 13, in <module>
2016-07-09T21:16:23.172469+00:00 app[web.1]:     Arbiter(self).run()
2016-07-09T21:16:23.145285+00:00 app[web.1]:     return self.load_wsgiapp()
2016-07-09T21:16:23.172910+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 231, in handle_chld
2016-07-09T21:16:23.172601+00:00 app[web.1]:     self.halt(reason=inst.reason, exit_status=inst.exit_status)
2016-07-09T21:16:23.173016+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 506, in reap_workers
2016-07-09T21:16:23.172317+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 192, in run
2016-07-09T21:16:23.172990+00:00 app[web.1]:     self.reap_workers()
2016-07-09T21:16:23.145298+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gevent/builtins.py", line 93, in __import__
2016-07-09T21:16:23.173286+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2016-07-09T21:16:23.172490+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 218, in run
2016-07-09T21:16:23.145742+00:00 app[web.1]: [2016-07-09 21:16:23 +0000] [9] [INFO] Worker exiting (pid: 9)
2016-07-09T21:16:23.983452+00:00 heroku[web.1]: State changed from starting to crashed
2016-07-09T21:16:23.968188+00:00 heroku[web.1]: Process exited with status 1
2016-07-09T21:16:43.235185+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=notes-in-short.herokuapp.com request_id=494cdb87-7e25-4340-992d-19c6a32b7e99 fwd="203.100.73.42" dyno= connect= service= status=503 bytes=
2016-07-09T21:20:15.679536+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=POST path="/upload" host=notes-in-short.herokuapp.com request_id=19dad39c-d05c-4130-8f69-3fff5b043d19 fwd="27.60.87.185" dyno= connect= service= status=503 bytes=
2016-07-09T21:22:26.694762+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/upload" host=notes-in-short.herokuapp.com request_id=85e4de0c-175b-45b7-8a41-34f93c1a1940 fwd="203.100.73.42" dyno= connect= service= status=503 bytes=
2016-07-09T21:22:31.702677+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=notes-in-short.herokuapp.com request_id=afb6d01b-b0ba-4379-a9a4-db4738eb3883 fwd="203.100.73.42" dyno= connect= service= status=503 bytes=
`

我已经尝试了很多,但我无法弄清楚到底出了什么问题。你能帮我调试吗?

1 个答案:

答案 0 :(得分:0)

您的comprehensive_search模块未被推送到heroku。它可能尚未提交到您的本地git存储库。

你可以通过创建一个关闭bash dyno从heroku方面告诉:

heroku run bash

您将获得一个远程shell,您可以发出linux命令以查看模块代码是否符合您的预期。

从那里你可以确保你已经正确地检查了目录。