简体   繁体   中英

App not compatible with buildpack - Heroku

When I run git push heroku master this is what I get:

C:\Users\Emanuele-PC\Desktop\project-mm-beta>git push heroku master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 505 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> App not compatible with 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 project-mm-beta.
remote:
To https://git.heroku.com/project-mm-beta.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/project-mm-beta.git'

The code I am trying to deploy is just one file (it's a test because it's my first time using Heroku) and it's written in Python. I have already set the buildpack (python) but it still doesn't work. How can I solve?

The Heroku Python Support will be applied to applications only when the application has a Pipfile or requirements.txt in the root directory.

Visit the documentation to get detailed instructions.

I just found out... It's quite a silly issue. Make sure the git repo is initialized within the project root folder. Suppose the project is a Django app and the project folder created by Django is my-project , the git repo needs to be initialized right within my-project for Heroku to work...

add pipfile & procfile, & commit them , this solved for me :)

You can see the files I am speaking of on this heroku sample : link

heroku buildpack on github : link

尝试添加一个名为 requirements.txt 的文件并输入您需要的任何内容,例如 django

Step 1) First setup the buildpack (programming-language )

For example : heroku buildpacks:set heroku/nodejs

Check for more info here : https://devcenter.heroku.com/articles/buildpacks

If the issue still exists, then follow next step

Step 2) git init and currently used directory is different , so this error is still thrown "App not compatible with buildpack:"

For example : git init command was used executed at :- C:/sample_folder/

But modules and package.json is under nested sub-folder :-

C:/sample_folder/nodejs_app/package.json

So move the files accordingly such that all the file are present under the same folder and then run

git push heroku master

--happy coding!

I was getting this error because I was making changes to a different branch. So I was working of a feature branch, then running git push heroku master . My changes had not been merged into my master branch, so thus the error. Once I merged in the Procfile to master I was able to push the changes up to heroku.

I was having the same error because I was not committing the files, make sure you run the command git add . then git commit -m'message' after changing any file, and then you can run git push heroku master and also add the requirements.txt and Procfile correctly.

You can try doing:

  1. pip3 freeze > requirements.txt
  2. heroku buildpacks:set heroku/python
  3. git add .; git commit -m "add requirements.txt"; git push heroku master

Note: Make sure you're in your root directory of your Python project :)

最后确保您没有忽略 .gitignore 中的requirements.txt ,那是我的问题。

You can specify the buildpack for python by this method

CLI Installation

heroku buildpacks:set https://github.com/heroku/heroku-buildpack-python.git

Check if you did the following steps:

  1. Activate your virtual environment.

  2. Run on your command prompt:
    pip freeze>requirements.txt

  3. Add Procfile in your main app directory (the same where manage.py is);
    inside Procfile you should insert:
    web: gunicorn your_app_name.wsgi

First file: requirements.txt

containing something like: gunicorn==19.7.1 or whatever the results of pip freeze > requirements.txt are.

Second file: Procfile

containing something like: web: gunicorn app:app or potentially blank. Note that app:app in this example is a reference to your python filename. It means that every time a web process is declared, and a dyno of this type is started, also run the command gunicorn app:app to start your web server.

Then git add . and git commit -m "added Procfile and requirements.txt" .

Then run git push heroku master to push from your local master branch to the heroku remote .

Well, same happened to me while I was creating a first-time Heroku app. Just add requirements.txt . It will work fine.

I had the same issue. Just make sure that you initialized the git repo inside the django project root. That way, your .git folder, .gitignore file, manage.py, requirements.txt, etc.. are on the same hierarchical level.

-> Make sure your requirements.txt & Procfile are in the root folder.

-> run following commands if you are not in the master branch already.

git checkout -b master
git add .
git commit -m "your commit message"
git push -u origin master
git push heroku master

我刚刚从连接到 Heroku 应用程序的 GitHub 存储库中删除了 README.md,这对我有用!

检查您是否编写了正确拼写的 Procfile 和 requirements.txt,因为它们区分大小写,在我的情况下,将 procfile 更改为 Procfile 后,它开始正常工作。

Run this command:

heroku buildpacks:set heroku/python

Also you can refer this document.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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