簡體   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