将python代码部署到heroku无法正常工作

时间:2016-10-06 19:33:02

标签: python django heroku

我已经为python添加了buildpack,它可以工作。

但是当我做一个git push它不起作用。

我一直得到以下错误。

(venv) D:\Projects\ecommerce\clone\cut_veggies>heroku buildpacks:set heroku/python
Buildpack set. Next release on cutveggie will use heroku/python.
Run git push heroku master to create a new release using this buildpack.

(venv) D:\Projects\ecommerce\clone\cut_veggies>git push heroku master
Counting objects: 308, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (305/305), done.
Writing objects: 100% (308/308), 410.14 KiB | 0 bytes/s, done.
Total 308 (delta 193), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Failed to detect set buildpack https://codon-        buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to cutveggie.
remote:
To https://git.heroku.com/cutveggie.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/cutveggie.git'

有人能说出我错过的东西吗?

2 个答案:

答案 0 :(得分:0)

我的应用程序也遇到了这个问题。将具有依赖项的requirements.txt文件添加到项目的根目录解决了它。查看here了解更多详情。您也可以查看here作为示例。

答案 1 :(得分:0)

我也有(现在仍然有)无法通过Heroku CLI推送应用程序的问题。

我发现的一个修复是使用浏览器登录Heroku并将您的GitHub帐户和回购链接到应用程序。然后通过GitHub进行部署。

他们提供两种可能性。一种是手动部署,您可以在运行全面测试后通过网站手动部署。另一个是自动部署,只要您将更改推送到链接到应用程序的分支,就会部署应用程序。

我一直在使用它,因为Windows决定对我发疯并阻止我将应用程序推送到heroku master。