Teral
Frameworks

Python

Deploy FastAPI, Flask, Django and other Python apps.

Teral recognizes a Python project by requirements.txt, pyproject.toml, Pipfile, or a main.py or app.py at the root. It installs dependencies with pip, uv, Poetry, PDM or Pipenv, depending on the files it finds.

How the app is started

FrameworkTeral runs
FastAPI, with uvicorn in your dependencies and the app in main.pyuvicorn main:app --host 0.0.0.0 --port $PORT
Flask, with gunicorn in your dependencies and the app in main.pygunicorn --bind 0.0.0.0:$PORT main:app
Djangopython manage.py migrate, then Gunicorn with your project's WSGI application
Anything elsepython main.py, or app.py, server.py and similar

For anything else, set Command in the app's settings, for example gunicorn myproject.wsgi --bind 0.0.0.0:8080. Commands are split at spaces and aren't run through a shell, so $PORT isn't expanded there. Use the port number from the app's settings.

Django projects run migrate on every start of every instance. If several instances start at once, they all try to migrate. For larger projects, run migrations from your CI before deploying, and set Command to start only Gunicorn.

Versions

Pin the Python version in .python-version, or with requires-python in pyproject.toml.

Listen on the right port

Read the port from PORT and bind to 0.0.0.0:

import os
import uvicorn

if __name__ == "__main__":
    uvicorn.run("main:app", host="0.0.0.0", port=int(os.environ.get("PORT", "8080")))
Edit on GitHub

On this page