2017-04-05 68 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 
相關問題