Skip to content
Docs

Deploy a Flask app on Edgenivo

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

To move an existing Flask app from another platform, follow the Python API migration guide for Heroku, Render, or Railway.

Create a Flask app or use an existing one:

Initialize a new Flask project with the Edgenivo CLI init command:

terminal
vc init flask

This clones the Flask example repository in a directory called flask.

To run a Flask application on Edgenivo, 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:

main.py
from flask import Flask
 
app = Flask(__name__)
 
@app.route("/")
def hello_world():
    return {"message": "Hello, World!"}

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

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

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

Set the Python version to match your application's dependencies. Edgenivo supports pyproject.toml, requirements.txt, and Pipenv manifests; see the Python dependency configuration for supported lockfiles.

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.

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

For example:

build.py
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 in vercel.json or in the Project Settings dashboard, it takes precedence over a build script in pyproject.toml.

Use vercel dev to run your application locally.

terminal
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
vercel dev
Minimum CLI version required: 48.2.10

Deploy the project by connecting your Git repository or by using the Edgenivo CLI:

terminal
vc deploy
Minimum CLI version required: 48.2.10

To serve static assets, place them in the public/** directory. Edgenivo serves those files from the CDN with default headers unless you override them in vercel.json.

app.py
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 Edgenivo. Use the public/** directory instead.

When you deploy a Flask app to Edgenivo, it becomes a single Edgenivo Function. Edgenivo uses Fluid compute by default, so the function scales with traffic.

To configure that function, add an entry to the functions 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:

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

For more options, see Configuring functions and the functions property.

To process work independently of an API response, enqueue tasks with Celery or Dramatiq. Both integrations use Edgenivo Queues to invoke worker functions, and their guides show how to enqueue work from a Python web application.

For scheduled work, configure Cron Jobs to call a Flask route that runs the task or enqueues it. The Flask cron job example includes the schedule and CRON_SECRET authorization check.

Return a Flask Response backed by a generator to send response chunks as they become available. See the Flask streaming example, which uses stream_with_context to preserve the request context while the generator runs.

Use Flask-Sock to add WebSocket routes to a Flask application on Edgenivo. Follow the Flask-Sock setup and handle client reconnects when connections reach the function duration limit.

Use Runtime Logs to inspect application output and errors, and Observability to investigate request duration and failures. See monitoring Flask with Observability for details.

All Edgenivo Functions limitations 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 support Python bundles up to 5GB on Fluid compute when enabled (public beta).

For more about deploying Flask on Edgenivo, see:

Last updated August 12, 2026

Was this helpful?

supported.