Documentation

Deploy a Python app

Deploy Django, Flask, FastAPI or any Python web app, worker or cron job on Rebasable.

Rebasable detects Python from requirements.txt, pyproject.toml (Poetry, uv or PDM), Pipfile or setup.py. It installs dependencies in a virtual environment and starts your app with the start command you set.

Requirements

  • Bind to 0.0.0.0:$PORT.
  • Choose the version with a .python-version file or requires-python in pyproject.toml.
  • Use a production server such as gunicorn or uvicorn.

Start commands

Framework Start command
Flask gunicorn app:app --bind 0.0.0.0:$PORT
Django gunicorn mysite.wsgi --bind 0.0.0.0:$PORT
FastAPI uvicorn main:app --host 0.0.0.0 --port $PORT
Celery worker celery -A proj worker -l info (as a background worker)

FastAPI example

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def home():
    return {"hello": "Rebasable"}

@app.get("/healthz")
def health():
    return "ok"

Django checklist

  • Set ALLOWED_HOSTS to include .rebasable.com and your custom domains (or read REBASABLE_EXTERNAL_HOSTNAME).
  • Pre-deploy command: python manage.py migrate --noinput.
  • Build command: pip install -r requirements.txt && python manage.py collectstatic --noinput.
  • Serve static files with WhiteNoise.
  • Read the database from DATABASE_URL (for example with dj-database-url).

Troubleshooting

  • ModuleNotFoundError: add the package to requirements.txt (or pyproject.toml) and redeploy.
  • Worker timeout: increase gunicorn’s --timeout or move slow work to a background worker.