2017-04-05 83 views
0

我无法将我的Flask应用程序部署到Heroku ... 我已经在每个线程中搜索了我可以和没有为我工作:添加一个runtime.txt,设置一个buildpack。我不知道现在可能会出现什么问题。Heroku Python未能检测到匹配的应用程序buildpack

下面是我的应用程序根目录:

Project 
- .git 
- Procfile 
- Readme.md 
- app 
- config.py 
- requirements.txt 
- runtime.txt 
- web.py 

这里的requirements.txt的内容:

appdirs==1.4.3 
click==6.7 
Flask==0.12.1 
Flask-WTF==0.14.2 
itsdangerous==0.24 
Jinja2==2.9.5 
MarkupSafe==1.0 
packaging==16.8 
pyparsing==2.2.0 
six==1.10.0 
Werkzeug==0.12.1 
WTForms==2.1 

的Procfile:

web: python web.py 

而且runtime.txt :

python-2.7.13 

当我做git push heroku master,它打印:

remote: Compressing source files... done. 
remote: Building source: 
remote: 
remote: !  No default language could be detected for this app. 
remote:    HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically. 
remote:    See https://devcenter.heroku.com/articles/buildpacks 
remote: 
remote: !  Push failed 
remote: Verifying deploy... 
remote: 
remote: ! Push rejected to appname. 
remote: 

我尝试添加buildpack与heroku buildpacks:add heroku/Python但后来它说,它不能检测应用的蟒蛇buildpack。

我可能做错了什么?

回答

1

requirements.py更改为requirements.txt

如果您使用默认的Python 2.7.13,则不需要runtime.txt。你会认为指定运行时间会触发语言检测,但即使没有要安装的包,Heroku requires一个空的requirements.txt

+0

对不起蟒蛇的版本,它已经是一个'requirements.txt',我复制文件名时出错 –

0

我花了很多时间与一个非常类似的错误。

在我的情况下,我试图部署一个Django的应用程序。

我只是运行这些命令来设置buildpack

heroku login 
    heroku create --stack cedar --buildpack git://github.com/heroku/heroku-buildpack-python.git 
    heroku config:add [email protected]:heroku/heroku-buildpack-python.git#purge 
    heroku config:set HEROKU=1 

我决定张贴在这里,是因为我花了很长的时间来获得这些提示

0

编辑您的Procfile到内容

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

我假设你的web.py文件包含在你的项目的根文件夹即你看到它,一旦你进入你的项目的“项目”文件夹。

否则,如果它包含在应用程序文件夹,然后用

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

我也遇到类似的问题。我能够通过添加runtime.txt修复它

只需把你使用的runtime.txt

python-2.7.14 
相关问题