# Deploy a Flask app on Vercel

Deploy a Flask app to Vercel with the Python runtime and Vercel Functions. Vercel looks for a `Flask` instance named `app` at supported entrypoints in your repository.

## Create or import your app

Create a Flask app or use an existing one:

[Deploy](/content/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fvercel%2Ftree%2Fmain%2Fexamples%2Fflask/index.html) [Live Example](https://vercel-plus-flask.vercel.app/)

### Get started with Vercel CLI

Initialize a new Flask project with the [Vercel CLI `init` command](/content/docs/cli/init/index.html):

```
vc init flask
```

This clones the [Flask example repository](https://github.com/vercel/vercel/tree/main/examples/flask) in a directory called `flask`.

## Exporting the Flask application

To run a Flask application on Vercel, define an `app` instance that initializes `Flask` at a supported entrypoint:

- `app.py`, `index.py`, `server.py`, `main.py`, `wsgi.py`, or `asgi.py`
- the same filenames inside `src/` or `app/`

For example:

```python
from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello_world():
    return {"message": "Hello, World!"}
```

To point Vercel to a Flask app in a custom module, set `tool.vercel.entrypoint` in `pyproject.toml`:

```toml
[tool.vercel]
entrypoint = "backend.server:app"
```

The `tool.vercel.entrypoint` value tells Vercel to look for a `Flask` instance named `app` in `./backend/server.py`.

### Build command

The `build` property in `[tool.vercel.scripts]` defines the Build Command for Flask deployments. It runs after dependencies are installed and before your application is deployed.

```toml
[tool.vercel.scripts]
build = "python build.py"
```

For example:

```python
def main():
    print("Running build command...")
    with open("build.txt", "w") as f:
        f.write("BUILD_COMMAND")

if __name__ == "__main__":
    main()
```

If you define a [Build Command](/content/docs/project-configuration/vercel-json#buildcommand/index.html) in `vercel.json` or in the Project Settings dashboard, it takes precedence over a build script in `pyproject.toml`.

### Local development

Use `vercel dev` to run your application locally.

```
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
vercel dev
```

Minimum CLI version required: 48.2.10

### Deploying the application

Deploy the project by connecting your Git repository or by using the [Vercel CLI](/content/docs/cli/deploy/index.html):

```
vc deploy
```

Minimum CLI version required: 48.2.10

## Serving static assets

To serve static assets, place them in the `public/**` directory. Vercel serves those files from the [CDN](/content/docs/cdn/index.html) with default [headers](/content/docs/headers/index.html) unless you override them in `vercel.json`.

```python
from flask import Flask, redirect

app = Flask(__name__)

@app.route("/favicon.ico")
def favicon():
    # /vercel.svg is automatically served when included in the public/** directory.
    return redirect("/vercel.svg", code=307)
```

Flask's `app.static_folder` should not be used for static files on Vercel. Use the `public/**` directory instead.

## Vercel Functions

When you deploy a Flask app to Vercel, it becomes a single [Vercel Function](/content/docs/functions/index.html). Vercel uses [Fluid compute](/content/docs/fluid-compute/index.html) by default, so the function scales with traffic.

To configure that function, add an entry to the [`functions`](/content/docs/project-configuration/vercel-json#functions/index.html) object in `vercel.json` keyed by your resolved entrypoint file. For example, to let an app defined in `main.py` run for up to 60 seconds, set `maxDuration`:

```json
{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "functions": {
    "main.py": {
      "maxDuration": 60
    }
  }
}
```

For more options, see [Configuring functions](/content/docs/functions/configuring-functions/index.html) and the [`functions`](/content/docs/project-configuration/vercel-json#functions/index.html) property.

## Limitations

All [Vercel Functions limitations](/content/docs/functions/limitations/index.html) apply to Flask applications, including:

- Application size: The Flask application becomes a single bundle, which has a standard bundle size limit of 500MB. [Large Functions](/content/docs/functions/limitations#large-functions-beta/index.html) support Python bundles up to 5GB on Fluid compute when enabled (public beta).

## More resources

For more about deploying Flask on Vercel, see:

- [Flask official documentation](https://flask.palletsprojects.com/)
- [Build with a Flask starter template](/content/kb/guide/build-with-a-flask-starter-template/index.html)
- [How to ship a Flask app on Vercel](/content/kb/guide/ship-a-flask-app-on-vercel/index.html)
- [Vercel Functions documentation](/content/docs/functions/index.html)
- [Backend templates on Vercel](/content/templates?type=backend/index.html)

Last updated August 12, 2026.
