[英]Heroku Python failed to detect app matching buildpack
我无法将我的 Flask 应用程序部署到 Heroku ......我已经在每个线程中进行了搜索,但没有任何效果对我有用:添加一个 runtime.txt,设置一个 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:
我试图用heroku buildpacks:add heroku/Python
添加一个buildpack heroku buildpacks:add heroku/Python
但它说它无法检测python buildpack的应用程序。
我可能做错了什么?
更改requirements.py
到requirements.txt
。
如果您使用默认 Python 2.7.13,则不需要runtime.txt
。 您可能认为指定运行时会触发语言检测,但即使没有安装包, Heroku 也需要一个空的requirements.txt
。
我花时间处理一个非常相似的错误。
就我而言,我尝试部署一个 django 应用程序。
我只是运行这些命令来设置 buildpack
heroku login
heroku create --stack cedar --buildpack git://github.com/heroku/heroku-buildpack-python.git
heroku config:add BUILDPACK_URL=git@github.com:heroku/heroku-buildpack-python.git#purge
heroku config:set HEROKU=1
我决定在这里发布这个,因为我花了很长时间才得到这些提示
将 Procfile 的内容编辑为
web: gunicorn web:app --log-file=-
我假设您的 web.py 文件包含在您项目的根文件夹中,即您一旦进入项目的“项目”文件夹就会看到它。
否则,如果它包含在 app 文件夹中,则使用
web: gunicorn app.web:app --log-file=-
我也遇到了类似的问题。 我能够通过添加 runtime.txt 来修复它
只需将您正在使用的python版本放在runtime.txt中
python-2.7.14
我迟到了,但如果您已经有一个 requirements.txt 文件并且收到此错误,请尝试添加一个 Procfile,如文档中所示: https ://devcenter.heroku.com/articles/getting- 开始与python#define-a-procfile
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.