简体   繁体   English

Flask App通过Heroku部署时由于Error = H10而导致应用程序错误

[英]Flask App results in Application Error when deployed through Heroku due to Error=H10

I am attempting to deploy a simple Flask app through Heroku, yet I am receiving an H10 Error. 我试图通过Heroku部署一个简单的Flask应用程序,但是却收到H10错误。 I am manually deploying with Github on the Heroku website. 我正在Heroku网站上与Github一起手动部署。

I have tried using to commands 'heroku restart', heroku ps:scale web=1, pip freeze > requirements.txt, and dynos and changing my Procfile to include -b :$PORT, changing the PORT in my flask python file to app.run(debug=True, port=33507, port = int(os.environ.get('PORT', 5000)) and app.run(host='0.0.0.0', port=port), changing my repo to match https://github.com/zachwill/flask_heroku , and adding gunicorn and gevent to the requirements.txt. 我已经尝试过使用命令'heroku restart',heroku ps:scale web = 1,pip Frozen> requirements.txt,和dynos并将我的Procfile更改为包括-b:$ PORT,将我的flask python文件中的PORT更改为app .run(debug = True,port = 33507,port = int(os.environ.get('PORT',5000))和app.run(host ='0.0.0.0',port = port),将我的仓库更改为匹配https://github.com/zachwill/flask_heroku ,然后将gunicorn和gevent添加到requirements.txt。

App 应用程式

port = int(os.environ.get('PORT', 5000))
if __name__ == '__main__':
    app.run(host='0.0.0.0', port=port)

Procfile 程序文件

web: gunicorn -b :$PORT flaskapp:app

requirements.txt requirements.txt

gunicorn
gevent

Error 错误

2019-07-08T19:29:05.872509+00:00 heroku[web.1]: State changed from starting to crashed
2019-07-08T19:29:05.497279+00:00 app[web.1]: [2019-07-08 19:29:05 +0000] [4] [INFO] Starting gunicorn 19.9.0
2019-07-08T19:29:05.498369+00:00 app[web.1]: [2019-07-08 19:29:05 +0000] [4] [INFO] Listening at: http://0.0.0.0:39703 (4)
2019-07-08T19:29:05.498552+00:00 app[web.1]: [2019-07-08 19:29:05 +0000] [4] [INFO] Using worker: sync
2019-07-08T19:29:05.505408+00:00 app[web.1]: [2019-07-08 19:29:05 +0000] [10] [INFO] Booting worker with pid: 10
2019-07-08T19:29:05.539492+00:00 app[web.1]: [2019-07-08 19:29:05 +0000] [10] [ERROR] Exception in worker process
2019-07-08T19:29:05.539497+00:00 app[web.1]: Traceback (most recent call last):
2019-07-08T19:29:05.539499+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2019-07-08T19:29:05.539501+00:00 app[web.1]: worker.init_process()
2019-07-08T19:29:05.539503+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
2019-07-08T19:29:05.539507+00:00 app[web.1]: self.load_wsgi()
2019-07-08T19:29:05.539510+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2019-07-08T19:29:05.539512+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2019-07-08T19:29:05.539514+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2019-07-08T19:29:05.539516+00:00 app[web.1]: self.callable = self.load()
2019-07-08T19:29:05.539518+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2019-07-08T19:29:05.539520+00:00 app[web.1]: return self.load_wsgiapp()
2019-07-08T19:29:05.539522+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2019-07-08T19:29:05.539524+00:00 app[web.1]: return util.import_app(self.app_uri)
2019-07-08T19:29:05.539526+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app
2019-07-08T19:29:05.539528+00:00 app[web.1]: __import__(module)
2019-07-08T19:29:05.539530+00:00 app[web.1]: File "/app/flaskapp.py", line 4, in <module>
2019-07-08T19:29:05.539532+00:00 app[web.1]: from pml import app
2019-07-08T19:29:05.539577+00:00 app[web.1]: ModuleNotFoundError: No module named 'pml'
2019-07-08T19:29:05.539825+00:00 app[web.1]: [2019-07-08 19:29:05 +0000] [10] [INFO] Worker exiting (pid: 10)
2019-07-08T19:29:05.555645+00:00 app[web.1]: [2019-07-08 19:29:05 +0000] [11] [INFO] Booting worker with pid: 11
2019-07-08T19:29:05.574207+00:00 app[web.1]: [2019-07-08 19:29:05 +0000] [11] [ERROR] Exception in worker process
2019-07-08T19:29:05.574212+00:00 app[web.1]: Traceback (most recent call last):
2019-07-08T19:29:05.574214+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2019-07-08T19:29:05.574216+00:00 app[web.1]: worker.init_process()
2019-07-08T19:29:05.574218+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
2019-07-08T19:29:05.574220+00:00 app[web.1]: self.load_wsgi()
2019-07-08T19:29:05.574222+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2019-07-08T19:29:05.574224+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2019-07-08T19:29:05.574226+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2019-07-08T19:29:05.574228+00:00 app[web.1]: self.callable = self.load()
2019-07-08T19:29:05.574230+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2019-07-08T19:29:05.574232+00:00 app[web.1]: return self.load_wsgiapp()
2019-07-08T19:29:05.574234+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2019-07-08T19:29:05.574236+00:00 app[web.1]: return util.import_app(self.app_uri)
2019-07-08T19:29:05.574238+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app
2019-07-08T19:29:05.574240+00:00 app[web.1]: __import__(module)
2019-07-08T19:29:05.574242+00:00 app[web.1]: File "/app/flaskapp.py", line 4, in <module>
2019-07-08T19:29:05.574244+00:00 app[web.1]: from pml import app
2019-07-08T19:29:05.574246+00:00 app[web.1]: ModuleNotFoundError: No module named 'pml'
2019-07-08T19:29:05.574494+00:00 app[web.1]: [2019-07-08 19:29:05 +0000] [11] [INFO] Worker exiting (pid: 11)
2019-07-08T19:29:05.682720+00:00 app[web.1]: [2019-07-08 19:29:05 +0000] [4] [INFO] Shutting down: Master
2019-07-08T19:29:05.682883+00:00 app[web.1]: [2019-07-08 19:29:05 +0000] [4] [INFO] Reason: Worker failed to boot.
2019-07-08T19:29:05.849393+00:00 heroku[web.1]: Process exited with status 3
2019-07-08T19:35:15.978510+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=randommovieroulette.herokuapp.com request_id=4e2ad446-cd8a-4136-9875-f94381259b5e fwd="173.71.157.150" dyno= connect= service= status=503 bytes= protocol=https
2019-07-08T19:35:18.311763+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=randommovieroulette.herokuapp.com request_id=154f2f1f-afeb-4765-8e05-1f908fe2d0f4 fwd="173.71.157.150" dyno= connect= service= status=503 bytes= protocol=https

The app is 'deploying', but something is wrong with the server end. 该应用程序正在“部署”,但是服务器端出了点问题。 Making a runtime.txt with my current python version stops the app from deploying. 使用我当前的python版本制作runtime.txt会阻止应用程序部署。 Should I make this a different version, then? 那我应该把它改成其他版本吗? I'm a newbie, so my deep apologies if I am making just a simple error. 我是新手,所以如果我犯了一个简单的错误,我深表歉意。

The requirements.txt did not include flask_wtf, bs4, requests, or app, all of which were imported in my flaskapp.py file. requirements.txt不包括flask_wtf,bs4,请求或应用程序,所有这些都已导入我的flaskapp.py文件中。 This file only included gunicorn and gevent previously. 此文件以前仅包括gunicorn和gevent。

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

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