When you have done with your development part you need to first check that application is working perfectly or not on your local server. If App is working fine then you have to follow these steps:
Create a Procfile
Heroku needs Profile in your app root directory. So create a Procfile( Without any extension) and save it with given below command. Given command in Procfile is used by Heroku app on startup.
Gunicorn(Green Unicorn) is a WSGI HTTP server that is used to run python based web applications.
Create Requirements.txt
It contains all the dependencies for my flask app.
Initialize git and add all files
# Initialize git repo
git init
Git add command Initialize a empty a git repo in working directory.
# add all changes from working directory to git
git add .
Now git add command add all files to git repo from working directory. Its tells the git add all the changes in next commit.
# commit all changes
git commit -m "first commit with your message"
Git commit command capture the snapshot of your project as a version of your project.
Deploy to Heroku
For deployment, create a free account at https://www.heroku.com/ . After successfully login you can create an app using heroku create command with you terminal.
Now git remote command gives us two url’s for fetch and for push.
Now final command git push heroku master
, this will push all your files to heroku cloud and installed all dependencies for us.
Finally my app is deployed on the heroku and live now.
Open https://nameless-wildwood-42104.herokuapp.com/ in your browser.
You will get the result like this:
Thanks for Reading 🙏
Happy Learning Happy Coding😃
Feel free to leave a comment or share this post. Follow me for future posts….