I know how hard it is to build a application and complete the final testing when all is ready we will be so excited to launch. Oh there is an error while deploying 😭😭😭. I know how it feels because I have met all those errors while deploying this website application on Heroku. This app which you are currently in (platiplus.com) is hosted in Heroku. Let's solve the error together. Be happy I am there with you to help you solve the errors. So the world can see the great application you've created.
1. Find the root cause for the error.
First find out whether the error is caused by the application itself or the error is due to Heroku. It may be caused due to improperly configured WSGI (web server gateway interface) or Procfile may not be identified.
Note : if you don't know how to host your application in Heroku go to the post I've put earlier and come back. In that post I've explained how to host and use Heroku postgressql database.
How to find the root cause ?
It's so simple in the CLI run any django command for example run
Heroku run python manage.py create superuser
If it produces an error then the error is due to your application read the error and copy and search in google. There will be solution especially in stack overflow if you don't find the solution contact me through Instagram or e-mail or put it in the comment sections. I'd love to help 🤞👍💖.
If it doesn't produce error then its more likely to be caused by Heroku go to Heroku dashboard and to your app and check your logs if it doesn't show you errors then go to command line either Heroku CLI or Git bash or whatever you use then type this command
heroku logs --tail --app <your_app_name>
You Could see errors and error code like below
Here you can find all error codes. I particularly faced error with error code H14. This error is probably caused because git may not tracked the changes to your Procfile. So let's see the fixe for this error.
- Delete your Procfile
- git add .
- git commit ( commit the changes )
- Add the Procfile again ( web: gunicorn <Your app name>.wsgi )
- git add .
- git commit ( Commit your change again )
- git push
- git push Heroku <Your git branch>
If this solution doesn't work for you then try pushing your branch to heroku before adding the Procfile again
In the heroku docs they tell that the error may be caused due to dynos. ie.. No dynos running. To fix this you need to scale your dynos from 0 to 1. To scale run the following command.
heroku ps:scale web=1
This will scale your dynos from 0 to 1. The Heroku Platform uses the container model to run and scale all Heroku apps. The containers used at Heroku are called “dynos.” More about dynos here
Try restarting your dynos
If you are still facing problem put it in the comments section or feel free to contact me through Instagram or e-mail or put it in the comment sections. I'd love to help 🤞👍💖. or you can contact heroku support or put your errors in stackoverflow