As a newbie, whenever I tried to deploy an app on Heroku, I always had problems with it. I encountered numerous errs followed by bouts of frustration, after which I abandoned it. A few days ago, as I tried to develop a messenger chatbot, I had to use Heroku. This time, I got it right! So, I document the steps followed below. Maybe my friend Eunice (my friend who abandoned heroku after getting frustrated) will be able to get it right this time too!
This tutorial assumes you have git and heroku installed. If not install them and follow along!
- Change directory to your app:
- If your app is not yet a git repository, initialize it:
- Stage your changes to be tracked by git
git add .
- Commit your changes to git
git commit -m "my first commit"
- To create a new heroku application, run
heroku createin your terminal within the directory.
- To add your program files to the heroku app, run the command below:
git push heroku master
- And to open it in your browser run
- With this, the app automatically opens in the browser!
Congratulations! You’ve have now deployed your first app to Heroku!
Other commands everyone must know:
heroku localhelps verify if heroku can run locally. Open
localhost:5000 to prove.
heroku configprints the configurations set for the application
heroku logsthis helps check for any errors that mayy have occured during the deployment.
Let’s grow together on this journey! I hope this helps!