部署到Heroku时Flask应用程序出错=error code=H10 desc=“应用程序崩溃”method=GET path="/",我使用的是Python 3

6ljaweal  于 2022-11-13  发布在  Python
关注(0)|答案(1)|浏览(163)

在Heroku中部署时,样品瓶应用程序在以下位置出现错误:=error code=H10 desc=“应用程序崩溃”method=GET path="/”。
我更改Procfile的次数与收到错误的次数一样多,但没有更好的结果。
run.py

import os

from flask_minify  import Minify

from apps import create_app
app = create_app()

DEBUG = app.config['DEBUG'] 

if __name__ == "__main__":
   app.run(debug=True)

过程文件:

web: gunicorn run:app

即将发生错误:

Process exited with status 1
2022-10-21T02:30:41.744294+00:00 heroku[web.1]: State changed from starting to crashed
2022-10-21T02:30:58.387078+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=increhub.herokuapp.com request_id=1dba507d-117f-47e9-8395-16452f0ec2ab fwd="106.79.203.182" dyno= connect= service= status=503 bytes= protocol=https
2022-10-21T02:30:59.567432+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=increhub.herokuapp.com request_id=be0decff-7481-4c97-95ce-6be3705e8d37 fwd="106.79.203.182" dyno= connect= service= status=503 bytes= protocol=https
2022-10-21T02:32:19.232749+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=increhub.herokuapp.com request_id=addba986-cc24-4218-b42a-a9629368288e fwd="106.79.203.182" dyno= connect= service= status=503 bytes= protocol=https
2022-10-21T02:32:19.740963+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=increhub.herokuapp.com request_id=6652df66-1dc8-43dd-adf4-f57800563199 fwd="106.79.203.182" dyno= connect= service= status=503 bytes= protocol=https
2022-10-21T02:36:35.452710+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=increhub.herokuapp.com request_id=28e38bc6-f861-4f88-a260-e463d6c4088e fwd="106.79.203.182" dyno= connect= service= status=503 bytes= protocol=https
2022-10-21T02:36:36.523511+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=increhub.herokuapp.com request_id=e3b958b2-3735-4a4f-a2b5-eb05efba2921 fwd="106.79.203.182" dyno= connect= service= status=503 bytes= protocol=https
2022-10-21T02:46:33.625471+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=increhub.herokuapp.com request_id=130a28f7-a437-4fdf-9608-8ef3b9697f13 fwd="106.79.203.182" dyno= connect= service= status=503 bytes= protocol=https
2022-10-21T02:46:35.058128+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=increhub.herokuapp.com request_id=f083adb6-466a-47cf-9697-dd2ece77043f fwd="106.79.203.182" dyno= connect= service= status=503 bytes= protocol=https
2022-10-21T02:47:22.882529+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=increhub.herokuapp.com request_id=370b8b2c-2d90-4abb-8904-59bba31961da fwd="106.79.203.182" dyno= connect= service= status=503 bytes= protocol=https
2022-10-21T02:47:22.280523+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=increhub.herokuapp.com request_id=dfad6625-cdaf-4396-85cc-d732e69dfada fwd="106.79.203.182" dyno= connect= service= status=503 bytes= protocol=https
at=error code=H10 desc="App crashed"
bis0qfac

bis0qfac1#

我认为您的问题在过程文件中。

请尝试将其更改为:

web: gunicorn --bind 0.0.0.0:$PORT flaskapp:app

另一个有用的命令是:

web: gunicorn flaskapp.wsgi --log-file-

如果有帮助,请告诉我。大多数情况下,此错误是由错误配置的Procfile引起的。我建议您一定要调查一下。

相关问题