I'm trying to deploy a Django app to Heroku. When I run the command git push heroku master
the following appears:
(uleague) ➜ pickapp git:(master) ✗ git push heroku master
Counting objects: 195, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (92/92), done.
Writing objects: 100% (195/195), 516.34 KiB | 0 bytes/s, done.
Total 195 (delta 93), reused 195 (delta 93)
remote: Compressing source files... done.
remote: Building source:
remote:
remote:
remote: ! Push rejected, no Cedar-supported app detected
remote: HINT: This occurs when Heroku cannot detect the buildpack
remote: to use for this application automatically.
remote: See https://devcenter.heroku.com/a...
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to shielded-crag-57385.
remote:
To https://git.heroku.com/shielde...
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shielde...
(uleague) ➜ pickapp git:(master) ✗
I have the following directory structure:
I have been following the Getting Started guide on Heroku for Python and Django and it understands that there is a file requirements.txt
but no folder requirements/base.txt/development.txt
Could this have something to do with it? Since when I perform the push, the first thing that starts is the process of installing the dependencies.
Could this be related to my mistake?
UPDATE
I've removed the requirements/ directory I had in the root of my Django project and created a single requirements.txt file in the root of my Django project and get the same result:
(uleague) ➜ pickapp git:(master) ✗ git remote -v
heroku https://git.heroku.com/fuupbol.git (fetch)
heroku https://git.heroku.com/fuupbol.git (push)
origin https://[email protected]/bgarcial/pickapp.git (fetch)
origin https://[email protected]/bgarcial/pickapp.git (push)
(uleague) ➜ pickapp git:(master) ✗ git push heroku master
Counting objects: 195, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (92/92), done.
Writing objects: 100% (195/195), 516.34 KiB | 0 bytes/s, done.
Total 195 (delta 93), reused 195 (delta 93)
remote: Compressing source files... done.
remote: Building source:
remote:
remote:
remote: ! Push rejected, no Cedar-supported app detected
remote: HINT: This occurs when Heroku cannot detect the buildpack
remote: to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to fuupbol.
remote:
To https://git.heroku.com/fuupbol.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/fuupbol.git'
(uleague) ➜ pickapp git:(master) ✗
I also tried leaving my requirements/ directory and having a requirements.txt in my root and there telling it to -r requirements/production.txt which calls base.txt (with the directory structure presented earlier in this question) and I didn't get either. results, it was the same error.
I don't know if I'm doing the right thing.
When you push to heroku, what heroku does is look for a buildpack that can understand the application you are deploying, for that the detect file of each buildpack is executed and the first one that is successful is the one that is assigned as the buildpack of your application.
In the case of python the detect looks for the requirements.txt file or the setup.py file, if neither of those files is there, heroku considers that your project is not python and continues testing.
You would have to add one of those files in the root of your application.
What you can do is have your file
requirements.txt
as you had thought, in the root of the project, with the following content:Then, as you see there, that file points to the file in the root
production.txt
folder/requirements/
of the project which is the one that will end up running when it is launched in production from Heroku.In turn, within the folder
/requirements/
you can have different files depending on your environment, for exampleIn which you are going to specify the packages for each environment.
Then
production.txt
it can contain the following, for exampleAs you can see, in my case, it calls first
base.txt
, installs all the default packages, and then installs the ones needed for production.There is also another question that you could also take into account, for a more pleasant development and implementation:
settings.py
into multiple files. Here is an excellent explanation of how to do it.