繁体   English   中英

在Heroku上部署Flask应用会导致构建错误

[英]Deploying Flask app on Heroku giving build error

我想出了在python上运行烧瓶的应用程序,该应用程序在localhost服务器上运行良好。

现在,在将其部署到云服务Heroku上时,构建失败并显示以下错误:

remote:          Downloading distribute-0.6.24.tar.gz (620kB)
remote:            Complete output from command python setup.py egg_info:
remote:            Traceback (most recent call last):
remote:              File "<string>", line 1, in <module>
remote:              File "/tmp/pip-install-_ofp1xky/distribute/setuptools/__init__.py", line 2, in <module>
remote:                from setuptools.extension import Extension, Library
remote:              File "/tmp/pip-install-_ofp1xky/distribute/setuptools/extension.py", line 2, in <module>
remote:                from setuptools.dist import _get_unpatched
remote:              File "/tmp/pip-install-_ofp1xky/distribute/setuptools/dist.py", line 103
remote:                except ValueError, e:
remote:                                 ^
remote:            SyntaxError: invalid syntax
remote:            
remote:            ----------------------------------------
remote:        Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-_ofp1xky/distribute/
remote:  !     Push rejected, failed to compile Python app.

以下是我的requirements.txt ::

docutils==0.11

MarkupSafe==0.19
Pygments==1.6
Sphinx==1.2.2

requests==1.2.0
Flask==0.10.1
Jinja2==2.6
Werkzeug==0.8.3
certifi==0.0.8
chardet==1.0.1
distribute==0.6.24
gunicorn==0.14.2

请帮忙! 感谢新手Flask。

似乎您应该使用distribute-0.7.3的发行版将distribute要求更新为。 还要记住,heroku支持最新的python,但是如果您想支持https://devcenter.heroku.com/articles/python-runtimes,则可以更改运行时。

除此之外,您可以完全删除distribute因为它不是必需的,这只是heroku中的一个示例。 Flask应用程序无需此即可运行。

最好将推荐样式与Pipfile结合使用,而不是与要求结合使用。

如果您想检查https://github.com/yefim/flask-heroku-sample,则为heroku烧瓶的一个很好的例子

暂无
暂无

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

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