简体   繁体   English

Flask- Heroku 应用程序错误 - 没有 Web 进程正在运行

[英]Flask- Heroku Application Error - No Web Process Running

I was trying to deploy a flask application online on heroku, The App is utilising SocketIO and Vanilla JS to handle the messages.我试图在 heroku 上在线部署 flask 应用程序,该应用程序正在利用 SocketIO 和 Vanilla JS 来处理消息。 I excepted it to run absolutely fine, It went smoothly and everything was installed but at the end, A Application Error Came Up saying-我除了它运行得非常好之外,它运行顺利,一切都安装好了,但最后,出现了一个应用程序错误说-

"Application error - An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command heroku logs --tail " “应用程序错误 - 应用程序中发生错误,无法提供您的页面。如果您是应用程序所有者,请检查您的日志以了解详细信息。您可以从 Heroku CLI 使用命令heroku logs --tail执行此操作”

In my command prompt I had a look at heroku logs --tail And got these results, I don't understand much about networking and heroku so please be light with my question.在我的命令提示符下,我查看了heroku logs --tail并得到了这些结果,我对网络和 heroku 不太了解,所以请对我的问题轻描淡写。

D:\Aryan\Programming\Flask\Chat App SocketIO>heroku logs --tail
2021-02-11T08:45:34.666077+00:00 app[api]: Initial release by user umasaryan@gmail.com
2021-02-11T08:45:34.666077+00:00 app[api]: Release v1 created by user umasaryan@gmail.com
2021-02-11T08:45:34.991030+00:00 app[api]: Enable Logplex by user umasaryan@gmail.com
2021-02-11T08:45:34.991030+00:00 app[api]: Release v2 created by user umasaryan@gmail.com
2021-02-11T08:46:05.544056+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/" host=fathomless-ridge-52370.herokuapp.com request_id=36071200-cbca-4ad7-b220-3f73cf436ab1 fwd="103.208.71.79" dyno= connect= service= status=502 bytes= protocol=https
2021-02-11T08:46:05.935453+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/favicon.ico" host=fathomless-ridge-52370.herokuapp.com request_id=ba898a18-92e8-4271-96c9-786d8abc9f39 fwd="103.208.71.79" dyno= connect= service= status=502 bytes= protocol=https
2021-02-11T08:49:02.160398+00:00 heroku[router]: at=info code=H81 desc="Blank app" method=GET path="/" host=openbrainstorm.herokuapp.com request_id=f1c07f1b-99f9-4955-8464-060b33a38cf2 fwd="103.208.71.79" dyno= connect= service= status=502 bytes= protocol=https
2021-02-11T08:49:59.000000+00:00 app[api]: Build started by user umasaryan@gmail.com
2021-02-11T08:50:23.887409+00:00 app[api]: Deploy 7910bc2e by user umasaryan@gmail.com
2021-02-11T08:50:23.887409+00:00 app[api]: Release v3 created by user umasaryan@gmail.com
2021-02-11T08:50:32.000000+00:00 app[api]: Build succeeded
2021-02-11T08:51:06.781160+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=openbrainstorm.herokuapp.com request_id=aa5747b5-6d22-41a4-bb54-e63607e80712 fwd="103.208.71.79" dyno= connect= service= status=503 bytes= protocol=https

I tried to fix this error by adding the Procfile that looks like this-我试图通过添加看起来像这样的 Procfile 来修复这个错误 -

web: gunicorn app:app --preload

This is what my directory structure looks like- Directory Structure Here这就是我的目录结构的样子 -目录结构在这里

But still my issue was not resolved.但是我的问题仍然没有解决。

Any more debugging details on this question are welcome欢迎对此问题提供更多调试细节
My Git Repo- https://github.com/ahmishra/Flask-ChatApp我的 Git 回购 - https://github.com/ahmishra/Flask-ChatApp

The first thing to do is to place the Procfile in the directory, where you initialized your git repository(where your requirements.txt is placed) or else Heroku will not be able to find it.首先要做的是将 Procfile 放在初始化 git 存储库(放置您的 requirements.txt)的目录中,否则 Heroku 将无法找到它。 Also you have not specified gunicorn in your requirements.txt so you also need to do that.此外,您还没有在 requirements.txt 中指定 gunicorn,因此您也需要这样做。 Finally, I would like to say that you may run into error(gunicorn issue) if you have same name of your folder and file(app and app.py).最后,我想说如果您的文件夹和文件(app 和 app.py)的名称相同,您可能会遇到错误(gunicorn 问题)。 So, you can rename app.py to appp.py and write this in the Procfile--因此,您可以将 app.py 重命名为 appp.py 并将其写入 Procfile——

web: gunicorn appp:app

Which means that gunicorn will try to find app module in appp.py.这意味着 gunicorn 将尝试在 appp.py 中查找 app 模块。

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

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