Home > Back-end >  Problems getting while hosting django app on heroku
Problems getting while hosting django app on heroku

Time:11-16

Hey there i have just hosted my Django app on Heroku and i faced theses two problem :

  1. "Failed to detect app matching no buildpack"
  2. Procfile declares types -> (none)

and when i run heroku logs --tail i get this

2013-08-31T21:00:25.085053 00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=/favicon.ico host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=503 bytes=

CodePudding user response:

Check with heroku ps if there is any process running: $ heroku ps That did not return anything.

So, a bit of search over the net and stackexchange pointed to something called the Procfile - which I had never used before. Apparently, heroku picks up the info on what to run automatically, but sometimes it jinxes. It is safer to put the information into a Procfile . This problem seems to keep recurring for over a year, but Heroku guys have not fixed it or fixed their tutorials, and that is where it all starts going downhill.

Now follow the steps below to fix it for your installation :

  1. Create a file called Procfile ( it is case sensitive - so capitalize P !) in the root directory of your application ( where you have the venv folder ) . On windows you will have to make sure that windows does not add a .txt extension . I use linux so it was just 'touch Procfile'.
  2. Edit the file and put in the following details for Django ( other apps you will need to figure out depending on what is needed to run it ) : web: python website/manage.py runserver 0.0.0.0:$PORT Note the spacing and the IP you need to give. If you miss out the last part, it will run on localhost which you will not be able to connect to from your machine.
  3. git add the file and do a git push heroku master to push this file to the server. We are not done yet even though the push says everything is fine.
  4. Remember the heroku ps did not give any results earlier ? So, now you need to attach the process. Do this with the following command to add a web dyno : $ heroku ps:scale web=1 Scaling web processes... done, now running 1 Check your website now and it should be working !

CodePudding user response:

1. For this Failed to detect app matching no buildpack:

find the platform you are working on and make a buildpack accordingly

  • Java: pom.xml

  • Ruby: Gemfile

  • Node.js:package.json

  • Python: requirements.txt / setup.py / Pipfile

  • PHP: composer.json / index.p

Eg if you are working on Django or flask make a buildpack in your root folder named as requirements.txt

2. Procfile declares types -> (none) Do the following to resolve it

  1. first delete your Procfile but copy the inside content in your clipboard
  2. Then type the following command in your root dir.. folder
  3. git init
  4. git add .
  5. git commit -m "procfile-commit"
  6. git push heroku master
  7. create a new Procfile and paste the content from your clipboard
  8. Then again type these following command
  9. git init
  10. git add .
  11. git commit -m "procfile-commit"
  12. git push heroku master
  • Related