Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法将Python 3 Flask应用程序推送到Heroku上_Python_Heroku_Flask - Fatal编程技术网

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

无法将Python 3 Flask应用程序推送到Heroku上,python,heroku,flask,Python,Heroku,Flask,我有一个简单直接的Python Flask应用程序。我正试图把它部署到Heroku上。我正在使用Python3运行时。我可以使用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),

我有一个简单直接的Python Flask应用程序。我正试图把它部署到Heroku上。我正在使用Python3运行时。我可以使用
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'
其中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支持

因此,您应该使用烧瓶0.10.1。修改您的requirements.txt,如下所示:

Flask==0.10.1
Werkzeug==0.10.4

您需要指定Python版本,以便Heroku使用正确的版本运行您的应用程序。只需使用以下代码创建一个名为runtime.txt的文件:
python-3.4.3
。在git中提交您的更改,并可以选择推送到Github。是的。这些都是我做的。我正在编辑我的问题,并添加所有与Heroku相关的文件。
Flask==0.10.1
Werkzeug==0.10.4