Deploying a FastAPI App


You can find the step-by-step deployment guide here.

Application Build
Copy link

Hostman uses the following environment when building a FastAPI application:

  • Python 3.10, 3.11, 3.12, 3.13, or 3.14 (you can select the version when creating an app)
  • pip
  • uvicorn

Hostman will execute the following commands during the build:

apt install -y p--no-install-recommends curl build-essential libpq-dev
pip install --upgrade pip
pip install fastapi uvicorn

To install dependencies, add the following line to the build command:

pip3 install --upgrade -r requirements.txt

The default start command is:

uvicorn main:app --host 0.0.0.0

If necessary, you can specify a port, for example:

uvicorn main:app --host 0.0.0.0 --port 80

Requirements
Copy link

  • Make sure the application initialization file is named main.py.
  • Make sure the application is listening on 0.0.0.0 rather than 127.0.0.1; otherwise, external connections will not work.