由于 gevent 导致 heroku 应用程序错误

heroku application error becaouse of gevent

当我尝试推送到 Heroku 时,它部署正确但显示应用程序错误。 enter image description here

无法更新, heroku 的日志如下

2018-09-13T04:54:13.237927+00:00 app[web.1]: import gevent

2018-09-13T04:54:13.237928+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gevent/init.py", line 41, in

2018-09-13T04:54:13.237930+00:00 app[web.1]: from gevent.hub import get_hub, iwait, wait

2018-09-13T04:54:13.237931+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gevent/hub.py", line 289

2018-09-13T04:54:13.237932+00:00 app[web.1]: except Exception, ex:

2018-09-13T04:54:13.237933+00:00 app[web.1]: ^

2018-09-13T04:54:13.237934+00:00 app[web.1]: SyntaxError: invalid syntax

2018-09-13T04:54:13.237936+00:00 app[web.1]: ]

2018-09-13T04:54:13.237944+00:00 app[web.1]:

好的,我明白了,您正在使用 Python 3 到 运行 您的 Heroku 应用程序。

2018-09-13T04:54:13.237931+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gevent/hub.py", line 289 行明确表示您正在使用 Python 3.6 运行 时间,并且您使用的 gevent 库适用于 Python 2。(异常是使用 Python 2 语法)

检查项目根文件夹中的 runtime.txt 并确保它显示 "python-2.7.15",Heroku 有关于为您的应用程序指定 python 运行time 的文档 https://devcenter.heroku.com/articles/python-runtimes.