How to deploy Your Flask App On Heroku Using Github stepbystep no error

Deploying a python flask app has many ways to do, and there is a lot of platforms available
Here I am going to show how to deploy python flask application on Heroku in a free plan

Let's Get started

I assume You already developed your flask application in your local environment, have a Heroku account, and have some basic knowledge of working with git and Command-line Interface.

Else If you are new Python Flask, Here  is Fantastic Book to Learn from Beginner to Professional

why Heroku?

Heroku Free account provides 550 free dyno hours and free domain
 Learn more at Heroku Free Dyno Hours
Heroku Provide some option to Deploy App: 
First one is deployed your app by linking your GitHub repository with your Heroku Account
Another one is using the Heroku Command-line Interface (Heroku CLI) by pushing the application on Heroku git servers
Here in this post, I will demonstrate how to deploy the flask app by linking your GitHub repository with Heroku

1: Deploy your app on GitHub:

Develop your application and initialize and commit your changes with git on your local work base 
if you want to know git basics of git Learn Git - Version Control 
Here in the example, I am making local repository contain one simple flask app called

2: Install a web server called Gunicorn

In order to host application Heroku, we need to install a web server called Gunicorn.
Run the following command in your command line to install gunicorn   
                                           pip install gunicorn

deploy flask app on heroku

3: Create a requirements.txt file

Now you want to output all your dependent packages for that application needs in a file called requirements.txt
run the following command in your command line
                                        pip freeze > requirements.txt
check the requirements.txt contains all your required packages to run the application
                                         cat requirements.txt

4: Create a Procfile:

Procfile is a mechanism for declaring what commands are run by your application’s dynos on the Heroku platform.
Create the file in name of Procfile    there is no Extension  and their P is Upper case
paste that following lines on Procfile
                                                         web gunicorn app:app
Here web is used by Heroku to start a web server for the application
app:app denotes that module and application name in our case both are called app if it differs on your application change that accordingly

5: Push that repository on Github:

Create a repository on GitHub
add and commit your files in the local repository 
And push that on the GitHub  master branch
Example Screenshots:

6: Create an App on Heroku:

Before creating an app make sure your GitHub account is connected with Heroku Account 
then Create an app on Heroku here is the example 
deploy flask app on heroku
Open your Heroku app go to deploy option 
select the Deployment method as  Github, 
Search your repository with a name and click connect 


On the below, you can see the manual deploy option 
select your branch name in the case it is a master branch
deploy flask app on heroku
click the deploy branch option 
Now your app started to deploy on Heroku wait for some time 
deploy flask app on heroku
after the successful message popup view your app by that URL
in the case, is my URL 
deploy flask app on heroku
Finish Now you have successfully deployed your application on Heroku 

If you see "Application Error"?

If you see the Any application error once again check your Procfile and make sure your python run time is supported by Heroku >  Heroku Python Support