Benjamin Bakhshi
Benjamin Bakhshi

Reputation: 663

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 [email protected]:fierce-atoll-4127.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]: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.

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

Upvotes: 17

Views: 19733

Answers (12)

Yash Agrawal
Yash Agrawal

Reputation: 51

All the above solutions dont mention that what matters is where is your .git initialised. Actually when you try push on heroku you should be doing it from the directory where you had initialsed the git itself. Also the directory you are uploading should be the one where you have files like

  • requirements.txt, Procfile, virtualenv, manage.py and .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.

Upvotes: 0

Bill Lennon
Bill Lennon

Reputation: 21

I struggled with this issue for a long time and the only solution was Vincent van Leeuwen's, but I didn't understand why. 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.

The solution is:

git push heroku current_branch:master

See heroku docs for more.

Hope this helps.

Upvotes: 2

You need to add the requirement.txt file to git and then push it will work of sure.

Upvotes: -1

faustineinsun
faustineinsun

Reputation: 451

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.

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

Upvotes: 1

Adrienne
Adrienne

Reputation: 2680

Heroku needs a requirements.txt file, which helps Heroku know what dependencies need to be installed for your Django project. You can use a tool generate your requirements.txt file.

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...

This link may be helpful: http://tutorial.djangogirls.org/deploy/README.html

Upvotes: 1

Enigmoid
Enigmoid

Reputation: 65

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.

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. So when I pushed to Heroku, I wasn't pushing those files!

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.

Hope this helps!

Upvotes: 2

user2067956
user2067956

Reputation:

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:

Procfile
requirements.txt
static/
myproject/
  manage.py
  app1/
  app2/
  ..

Upvotes: 8

hum3
hum3

Reputation: 1711

My stupid error was to mispell requirements.txt as the erroneous requirments.txt. I didn't need setup.py.

Additionally I need to actually store the git repository in Github. Just creating it locally wasn't enough.

Upvotes: 2

user3650331
user3650331

Reputation: 49

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 !

Upvotes: 3

Vincent van Leeuwen
Vincent van Leeuwen

Reputation: 701

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!

Upvotes: 33

Wing Lian
Wing Lian

Reputation: 2418

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. See https://github.com/heroku/heroku-buildpack-python/blob/master/bin/detect

Upvotes: 2

Udi
Udi

Reputation: 30472

You probably need to add a requirements.txt file. check the python app docs

Upvotes: 13

Related Questions