我正在尝试部署一个python应用程序,该应用程序在Heroku上使用Flask,它在本地成功运行。我想在这里提一下,我是Heroku的新手。这是我在Heroku上部署应用程序时看到的错误:
2016-12-18T11:36:56.050654+00:00 heroku[web.1]: State changed from starting to crashed
2016-12-18T11:36:56.051465+00:00 heroku[web.1]: State changed from crashed to starting
2016-12-18T11:37:00.483391+00:00 heroku[web.1]: Starting process with command `gunicorn heythere:app`
2016-12-18T11:37:03.307781+00:00 heroku[web.1]: State changed from starting to crashed
2016-12-18T11:37:03.130744+00:00 app[web.1]: [2016-12-18 11:37:03 +0000] [4] [INFO] Starting gunicorn 19.6.0
2016-12-18T11:37:03.131398+00:00 app[web.1]: [2016-12-18 11:37:03 +0000] [4] [INFO] Listening at: http://0.0.0.0:28597 (4)
2016-12-18T11:37:03.131586+00:00 app[web.1]: [2016-12-18 11:37:03 +0000] [4] [INFO] Using worker: sync
2016-12-18T11:37:03.138989+00:00 app[web.1]: [2016-12-18 11:37:03 +0000] [10] [INFO] Booting worker with pid: 10
2016-12-18T11:37:03.149477+00:00 app[web.1]: [2016-12-18 11:37:03 +0000] [10] [ERROR] Exception in worker process
2016-12-18T11:37:03.149479+00:00 app[web.1]: Traceback (most recent call last):
2016-12-18T11:37:03.149481+00:00 app[web.1]: worker.init_process()
2016-12-18T11:37:03.149480+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 557, in spawn_worker
2016-12-18T11:37:03.149482+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
2016-12-18T11:37:03.149483+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 136, in load_wsgi
2016-12-18T11:37:03.149483+00:00 app[web.1]: self.load_wsgi()
2016-12-18T11:37:03.149485+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2016-12-18T11:37:03.149484+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2016-12-18T11:37:03.149485+00:00 app[web.1]: self.callable = self.load()
2016-12-18T11:37:03.149486+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2016-12-18T11:37:03.149487+00:00 app[web.1]: return self.load_wsgiapp()
2016-12-18T11:37:03.149487+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2016-12-18T11:37:03.149488+00:00 app[web.1]: return util.import_app(self.app_uri)
2016-12-18T11:37:03.149489+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 357, in import_app
2016-12-18T11:37:03.149489+00:00 app[web.1]: __import__(module)
2016-12-18T11:37:03.149490+00:00 app[web.1]: File "/app/heythere.py", line 1, in <module>
2016-12-18T11:37:03.149491+00:00 app[web.1]: from flask import Flask,render_template,render_template_string, redirect
2016-12-18T11:37:03.149491+00:00 app[web.1]: ImportError: No module named flask
2016-12-18T11:37:03.149680+00:00 app[web.1]: [2016-12-18 11:37:03 +0000] [10] [INFO] Worker exiting (pid: 10)
2016-12-18T11:37:03.181304+00:00 app[web.1]: [2016-12-18 11:37:03 +0000] [4] [INFO] Shutting down: Master
2016-12-18T11:37:03.181469+00:00 app[web.1]: [2016-12-18 11:37:03 +0000] [4] [INFO] Reason: Worker failed to boot.
2016-12-18T11:37:03.287985+00:00 heroku[web.1]: Process exited with status 3
2016-12-18T11:38:21.416597+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=mavsblog.herokuapp.com request_id=7851485a-9712-4e03-acd1-117b48f714d8 fwd="183.87.39.130" dyno= connect= service= status=503 bytes=
2016-12-18T11:38:22.274524+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=mavsblog.herokuapp.com request_id=b1d9d2c2-bec3-4dab-b673-4968bbdf9a40 fwd="183.87.39.130" dyno= connect= service= status=503 bytes=
根据我的理解错误说ImportError: No module named flask
我推送到heroku的requirements.txt是:
blinker==1.4
click==6.6
Flask==0.11.1
Flask-Blogging==0.7.2
Flask-Cache==0.13.1
Flask-Login==0.4.0
Flask-Principal==0.4.0
Flask-WTF==0.13.1
gunicorn==19.6.0
itsdangerous==0.24
Jinja2==2.8
Markdown==2.6.7
MarkupSafe==0.23
SQLAlchemy==1.1.3
virtualenv==15.0.3
Werkzeug==0.11.11
WTForms==2.1
当我将代码+ requirements.txt推送到heroku时
我不知道为什么但Flask模块没有安装,
我做了:
git push -f heroku master
推送我的代码只安装gunicorn,而没有其他模块来自 - requirements.txt。
我在这里缺少什么?请建议!!