Deploying Flask & FastAPI

Learn how to host lightweight and fast API architectures like Flask and FastAPI on Skyversal. Uvicorn and Gunicorn integration.

If you are developing microservices or just need a lightweight backend API, Flask or the modern asynchronous FastAPI are excellent choices. Skyversal supports both of these architectures out of the box.

💧 Flask Deploy

Flask uses WSGI standards. Just like Django, it works perfectly with Gunicorn.

Example Structure
requirements.txt
Flask==3.0.0
gunicorn==20.1.0

app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello(): return "Hello Flask!"
Start Command

When Skyversal looks at your app.py file and finds the app object, it automatically runs gunicorn app:app. If you have a more complex structure, you can override the start command via the dashboard.

⚡ FastAPI Deploy (Asynchronous - ASGI)

Because FastAPI uses an asynchronous structure, it is served using Uvicorn (or Uvicorn as a worker class for Gunicorn) instead of traditional WSGI Gunicorn. Skyversal handles this distinction seamlessly.

Example Structure
requirements.txt
fastapi==0.103.1
uvicorn[standard]==0.23.2

main.py
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root(): return {"Hello": "FastAPI"}
Start Command

If your main file is named main.py, Skyversal automatically runs uvicorn main:app --host 0.0.0.0 --port 8080. If you use a different entry point, configure your custom command in the dashboard.

⚠️
Port Listening Rule (Crucial)

When developing Python apps (especially when writing custom start commands), ensure that your application listens to the PORT environment variable (or port 8080 by default) and binds to the address 0.0.0.0. If you listen on 127.0.0.1 (localhost), Skyversal's external internet traffic will not be able to reach your container.

Last updated on July 27, 2026
Edit this page on GitHub