繁体   English   中英

无法将Python 3 Flask应用程序推送到Heroku上

[英]Unable to push a Python 3 Flask app onto Heroku

我有一个简单直接的Python Flask应用程序。 我正在尝试在Heroku上部署它。 我正在使用Python 3运行时。 我可以使用foreman start在本地运行它,但它无法在Heroku上构建并拒绝它。

这是日志:

Counting objects: 29, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (25/25), done.
Writing objects: 100% (29/29), 6.08 KiB | 0 bytes/s, done.
Total 29 (delta 11), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing runtime (python-3.4.3)
remote: -----> Installing dependencies with pip
remote:        Collecting Flask==0.9 (from -r requirements.txt (line 1))
remote:          Downloading Flask-0.9.tar.gz (481kB)
remote:            Complete output from command python setup.py egg_info:
remote:            Traceback (most recent call last):
remote:              File "<string>", line 20, in <module>
remote:              File "/tmp/pip-build-r95ud3px/Flask/setup.py", line 62
remote:                print "Audit requires PyFlakes installed in your system."
remote:                                                                        ^
remote:            SyntaxError: Missing parentheses in call to 'print'
remote:            
remote:            ----------------------------------------
remote: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-r95ud3px/Flask
remote: 
remote:  !     Push rejected, failed to compile Python app
remote: 
remote: Verifying deploy....
remote: 
remote: !   Push rejected to xxxxxxxxxxxxxxxxxx.
remote: 
To https://git.heroku.com/xxxxxxxxxxxxxxxxxx.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/xxxxxxxxxxxxxxxxxx.git'

那么,我究竟做错了什么?

编辑:

文件:Procfile

web: gunicorn app:app --log-file=-

app.py是主应用程序的位置。

文件:requirements.txt

Flask==0.9
Jinja2==2.6
Werkzeug==0.8.3
gunicorn==0.17.2

文件:runtime.txt

python-3.4.3

Flask版本0.9不支持python 3,因为它在文档中读取:

Flask 0.10和Werkzeug 0.9是第一个引入Python 3支持的版本。

所以你应该使用Flask 0.10.1 修改您的requirements.txt如下:

Flask==0.10.1
Werkzeug==0.10.4

暂无
暂无

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

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