部署使用Flask的应用到Heroku的构建问题

2024-05-13 08:50:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我用python开发了一个flask应用程序,它在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.

下面是我的要求.txt::

^{pr2}$

请帮忙!谢谢你的新手。在


Tags: installpipinfrompyremoteeggsetup
1条回答
网友
1楼 · 发布于 2024-05-13 08:50:00

似乎您应该将distribute需求更新为distribute-0.7.3。请记住,heroku支持最新的python,但是如果希望支持https://devcenter.heroku.com/articles/python-runtimes,可以更改运行时

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

另外,最好使用带有Pipfile的推荐样式,而不是requirements。在

如果你想检查https://github.com/yefim/flask-heroku-sample

相关问题 更多 >