How to deploy your flask app for free on Heroku

Day 5: 20 Days of learning challenge

Vatsal kulshreshtha
2 min readJan 8, 2021

Today we will be going to learn how to deploy your flask app for free on Heroku.

First of all we need to understand why do we need deploy. Deploy simply means to make your backend app public which can be used by client applications.

NOTE: If you are a college student, apply for GitHub Student Developer Pack. Which will give you one year free Hobby Dyno for upto two years.

Let’s Deploy!!!

I will be deploying the Study Partner app’s backend. which can be found on my GitHub: https://github.com/vatsalkul/study-partner

For deploying our flask app we need to make a file named Procfile.

web: gunicorn run:application

here application is the variable of flask app

application = Flask(__name__)application.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///database.db"application.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

Now, we will setup new app in heroku.

In Deploy section we need to select GitHub (you can also use Heroku Git or Container like docker). For the sake of simplicity, I will use GitHub and connect my master or main branch.

You can also select automatic deploy which will automatically deploy your app whenever you commit changes to github repo.

Hurrayy!! App is successfully deployed.

Here is the link: https://study-partner.herokuapp.com

--

--

No responses yet