sota.io

Deploy Python

Deploy a Python application (Flask, FastAPI, Django) to sota.io.

Auto-Detection

sota.io detects Python projects by looking for:

  • requirements.txt in the project root
  • pyproject.toml with build dependencies

For Python apps, we recommend including a Dockerfile for precise control over the runtime:

Flask

FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8080
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "app:app"]

FastAPI

FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8080
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]

Quick Deploy

cd my-python-app
sota deploy

Port Configuration

Your app must listen on port 8080 (provided as the PORT environment variable):

import os
port = int(os.environ.get("PORT", 8080))

Environment Variables

sota env set FLASK_ENV=production
sota env set DATABASE_URL=postgres://...
sota env set SECRET_KEY=your-secret

Requirements File

Make sure your requirements.txt includes all production dependencies:

flask==3.0.0
gunicorn==21.2.0
psycopg2-binary==2.9.9