简体   繁体   English

部署到Heroku的Flask应用程序返回应用程序错误

[英]Flask application deployed to Heroku returns Application Error

I'm having trouble with heroku not successfully running my app. 我遇到heroku无法成功运行我的应用程序的麻烦。 I have 3 key files: 我有3个关键文件:

  1. A python file with the core engine. 带有核心引擎的python文件。
  2. A python file that calls the first python file and runs Flask to render_template into index.html , and 一个python文件,该文件调用第一个python文件并运行Flask将render_template转换为index.html ,并且
  3. An index.html file that uses the data generated from the core engine (via the second python file) to render the page. 一个index.html文件,该文件使用核心引擎生成的数据(通过第二个python文件)来呈现页面。

I recorded all the dependencies needed in a requirements.txt file, and followed the "Deploying to Heroku" instructions on this boilerplate page . 我将所有所需的依赖项记录在了requirements.txt文件中,并按照此样板页面上的“部署到Heroku”中的说明进行操作

After doing the git push heroku master I got an Application Error on the heroku app. 完成git push heroku master我在heroku应用程序上遇到了应用程序错误。 Here's the heroku logs dump: 这是heroku日志转储:

(venv)Bobs-MacBook-Pro:headline master$ heroku logs
2014-09-15T08:04:42.500102+00:00 heroku[api]: Enable Logplex by xxx@gmail.com
2014-09-15T08:04:42.500102+00:00 heroku[api]: Release v2 created by xxx@gmail.com
2014-09-15T08:10:32+00:00 heroku[slug-compiler]: Slug compilation started
2014-09-15T08:11:21+00:00 heroku[slug-compiler]: Slug compilation finished
2014-09-15T08:11:21.409088+00:00 heroku[api]: Deploy fa8d344 by xxx@gmail.com
2014-09-15T08:11:21.409184+00:00 heroku[api]: Release v3 created by xxx@gmail.com
2014-09-15T08:11:23.833224+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=headlyneme.herokuapp.com request_id=6ea6633a-4bfa-4cfa-9345-ac77f570e6a9 fwd="54.82.116.215" dyno= connect= service= status=503 bytes=
2014-09-15T08:11:55.722627+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=headlyneme.herokuapp.com request_id=ed7d46ba-cef2-4aef-bbe6-49e8244cb04c fwd="24.130.57.252" dyno= connect= service= status=503 bytes=
2014-09-15T08:11:56.045572+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=headlyneme.herokuapp.com request_id=08d43fc9-977a-4c89-86a3-267224fbb5a7 fwd="24.130.57.252" dyno= connect= service= status=503 bytes=

What am I doing wrong? 我究竟做错了什么? I've run this locally on my Mac using app.run(debug=True) without any problems, as seen here . 我已经使用app.run(debug=True)在Mac上本地运行了此程序,没有任何问题, 如此处所示 I'm guessing something's wrong in the sequence the python files are running? 我猜测python文件运行的顺序有问题吗?

This usually occurs when you add your Procfile after you push your other files. 当您在推送其他文件后添加Procfile时,通常会发生这种情况。 Therefore, your heroku app is not aware of the Procfile and you don't have any dynos running. 因此,您的heroku应用程序不了解Procfile,并且没有任何测功机在运行。

Try running heroku ps:scale web=1 to form a dyno, which will hopefully allow your app to handle web requests. 尝试运行heroku ps:scale web=1形成一个dyno,这将有望使您的应用处理Web请求。 I hope this helps! 我希望这有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM