简体   繁体   English

git push heroku master:Heroku推送被拒绝,没有检测到Cedar支持的应用程序

[英]git push heroku master: Heroku push rejected, no Cedar-supported app detected

I tried running: 我试过跑:

$ git push heroku master    
-----

Total 7121 (delta 2300), reused 6879 (delta 2228)
 !     Heroku push rejected, no Cedar-supported app detected

To git@heroku.com:fierce-atoll-4127.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:fierce-atoll-4127.git'

The only possible answers that I have found suggested that if you have an underscore in your app name, it might cause this problem. 我发现的唯一可能的答案表明,如果您的应用名称中有下划线,则可能会导致此问题。 I had a "-" and I removed it, but I still can't get this work. 我有一个“ - ”,我把它删除了,但我仍然无法完成这项工作。

The following is in my requirements.txt, which sits under my src folder, alongside settings.py and manage.py. 以下是我的requirements.txt,它位于我的src文件夹下,与settings.py和manage.py一起。

Django==1.4.3
South==0.7.6
distribute==0.6.31
ipython==0.13.1
wsgiref==0.1.2
dj-database-url==0.2.0

Just had this problem too. 刚刚遇到这个问题。 I did the following to solve it: (assuming you're in project dir) 我做了以下工作来解决它:(假设你在项目目录中)

rm -rf .git
git init 
git add .
git commit -m "First commit"
heroku create --stack cedar
git push heroku master

A slightly involved solution to create a new application, but at least it works. 一个稍微涉及的解决方案来创建一个新的应用程序,但至少它是有效的。 Hope that helps! 希望有所帮助!

You probably need to add a requirements.txt file. 您可能需要添加requirements.txt文件。 check the python app docs 检查python app docs

I had a similar issue and in my case was because my apps were outside of my project folder. 我有一个类似的问题,在我的情况下是因为我的应用程序在我的项目文件夹之外。 Heroku expects to have this structure: Heroku希望有这样的结构:

Procfile
requirements.txt
static/
myproject/
  manage.py
  app1/
  app2/
  ..
rm -rf .git
git init 
git add .
git commit -m "First commit"
heroku create --stack cedar
git push heroku master

This worked for me as well ! 这对我也有用!

Since Django is a python app, you'll need to have requirements.txt and setup.py sit in the root of your repo and not the src sub-directory. 由于Django是一个python应用程序,你需要让requirements.txtsetup.py位于你的repo的根目录而不是src子目录。 See https://github.com/heroku/heroku-buildpack-python/blob/master/bin/detect 请参阅https://github.com/heroku/heroku-buildpack-python/blob/master/bin/detect

My stupid error was to mispell requirements.txt as the erroneous requirments.txt . 我的愚蠢错误是mispell requirements.txt的错误requirments.txt I didn't need setup.py . 我不需要setup.py

Additionally I need to actually store the git repository in Github. 另外,我需要在Github中实际存储git存储库。 Just creating it locally wasn't enough. 仅在本地创建它是不够的。

For everyone deleting their Git history to make this work... the only reason that works is because the initial commit in the new repository contains the necessary files for Heroku to recognize your app. 对于每个人都删除他们的Git历史记录来完成这项工作......唯一的原因是因为新存储库中的初始提交包含Heroku识别您的应用程序所需的文件。

I ran into this problem because I added the Procfile and requirements.txt for my app and tried to push to Heroku before actually committing them. 我遇到了这个问题,因为我为我的应用程序添加了Procfilerequirements.txt ,并尝试在实际提交之前推送到Heroku。 So when I pushed to Heroku, I wasn't pushing those files! 所以当我推到Heroku时,我并没有推动那些文件!

Making a commit with all the necessary files and then pushing should solve this problem, and is vastly preferable to deleting your entire Git history. 使用所有必需的文件提交然后推送应该可以解决这个问题,并且非常希望删除整个Git历史记录。

Hope this helps! 希望这可以帮助!

I struggled with this issue for a long time and the only solution was Vincent van Leeuwen's , but I didn't understand why. 我很长一段时间都在努力解决这个问题,而唯一的解决方案是Vincent van Leeuwen ,但我不明白为什么。 The problem turned out to be that I was working from a local branch other than master. 问题原来是我在除了主人以外的当地分支机构工作。 So when I was running 所以当我跑步的时候

git push heroku master

I was actually pushing 我其实是在推动

(local) master->(heroku) master

and not 并不是

(local) current_branch -> (heroku) master

as I intended. 正如我的意图。 This failed because my local master branch didn't have requirements.txt, Procfile, etc. 这失败了,因为我的本地主分支没有requirements.txt,Procfile等。

The solution is: 解决方案是:

git push heroku current_branch:master

See heroku docs for more. 有关更多信息,请参阅heroku文档

Hope this helps. 希望这可以帮助。

Heroku needs a requirements.txt file, which helps Heroku know what dependencies need to be installed for your Django project. Heroku需要一个requirements.txt文件,这有助于Heroku了解需要为Django项目安装哪些依赖项。 You can use a tool generate your requirements.txt file. 您可以使用工具生成您的requirements.txt文件。

Run in command line 在命令行中运行

pip freeze > requirements.txt

which will create a requirements.txt file with all your installed packages, such as Django, django-registration, etc... 这将创建一个包含所有已安装软件包的requirements.txt文件,例如Django,django-registration等...

This link may be helpful: http://tutorial.djangogirls.org/deploy/README.html 此链接可能会有所帮助: http//tutorial.djangogirls.org/deploy/README.html

My situation is that my codes are needed to save both on Github and Heroku, if I use the following solution, rm -rf .git will delete the connection to my Github, therefore I can't push my codes to Github. 我的情况是我的代码需要保存在Github和Heroku上,如果我使用以下解决方案, rm -rf .git将删除与我的Github的连接,因此我无法将我的代码推送到Github。

rm -rf .git
git init 
git add .
git commit -m "First commit"
heroku create --stack cedar-14
git push heroku master

Instead, my solution is as follows: 相反,我的解决方案如下:

$ heroku create
$ heroku config:add BUILDPACK_URL=git://github.com/heroku/heroku-buildpack-python.git
$ git push heroku master

你需要将requirement.txt文件添加到git然后推送它肯定会工作。

All the above solutions dont mention that what matters is where is your .git initialised. 所有上述解决方案都没有提到重要的是你的.git初始化的地方。 Actually when you try push on heroku you should be doing it from the directory where you had initialsed the git itself. 实际上当你尝试推送heroku时,你应该从你初始化git本身的目录中进行。 Also the directory you are uploading should be the one where you have files like 您上传的目录也应该是您拥有文件的目录

  • requirements.txt, Procfile, virtualenv, manage.py and .gitignore requirements.txt,Procfile,virtualenv,manage.py和.gitignore

    etc. In short Heroku needs all files to understand the type of project you want to upload so these files should be accessible on the root directory. 简而言之,Heroku需要所有文件来理解您要上传的项目类型,因此这些文件应该可以在根目录中访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM