Hostwizly

Deploy Flask App On Vercel For FREE

Last Updated 05 May 2025 by Jarvis Silva

Looking to host your flask api on Vercel? then you are at the right place. In this tutorial, I will show you how to deploy flask app on Vercel for absolutely FREE.

Flask is a popular microframework in python which is used for developing apis and web apps in python.

Vercel is a web hosting platform which allows developers to easily host their websites, they have a hobby plan on which you can host your projects completely for free.

To use flask we need python and Vercel has serverless functions which supports python runtime which we can use to run our flask apps. So let's see how to do it step by step.

1. Configure flask project for deploying to Vercel

First we need to configure our flask app to make it deployable on Vercel, let's see how to do it step by step:

  1. First create a api folder in the root, add a app.py file inside it and add a basic flask api code that returns hello world on get request, you can see from below.
  2. flask Api demo code

    Note: It is mandatory to create a api folder and put all your api codes inside it as Vercel will look for the codes in the api folder when deploying.

  3. Now create a vercel.json file in the root of the project and add the below code in it.
  4. {
      "builds": [
        {
          "src": "api/app.py",
          "use": "@vercel/python"
        }
      ],
      "routes": [
        {
          "src": "/(.*)",
          "dest": "api/app.py"
        }
      ]
    }

    This file will tell Vercel we want to use python runtime and define our routes.

  5. Now since we are using flask we need to create a requirements.txt file in the root folder of our flask project and add flask in it and also add the name of any other third party library you are using in your project.
  6. flask requirment.txt file

Now our flask app is ready for deployment on Vercel. Refer here for more advanced configuration: Using Vercel Serveless Functions.

2. Upload flask code to Github

To deploy any app on Vercel we need to first upload the code on Github repository then in Vercel connect github account, so let's first upload code to github.

  1. Open Github and login to your account, click on create a new repository, enter your app name, leave rest everything default and click create repository.
  2. Now it will show you commands to push your code to this repository, open a terminal at your static website code location and run all the commands one by one or you can drag and drop.
  3. Github new repository page with commands

Read: How to push code to github

After you run all the commands you should see your code uploaded to your Github repository.

3. Deploying Flask App to Vercel

  1. Go to your Vercel dashboard and click on the add new button it will open a dropdown in that click on project.
  2. Vercel new project button page
  3. Now it will open a new page displaying your Github repositories, now here you need to click on import of your flask app repository you just pushed to Github.
  4. Vercel git repo import page
  5. Now it will ask you to enter your project name, leave the other settings as default and click on deploy.
  6. vercel project deployment final step

    Now it will start building your flask app and deploy it on Vercel, it will generate some preview urls which you can use to visit your flask app, you can also connect a custom domain if you want.

Also Read: Deploy express app to Vercel

This way one can easily deploy flask apps on Vercel for FREE, I hope you found this tutorial helpful and you were able to host your flask app on vercel. Thank you for reading, Have a nice day 😊

About the author

I am Jarvis Silva, a tech enthusiast. I have 5 years of experience in website hosting and development, Now sharing all my knowledge related to web hosting and other various tech on the internet through Hostwizly.

Free Wordpress Website Setup

We will setup your wordpress website for free and get you started on your online journey.

Claim

Related Articles