Guide for deploying FastAPI applications written in Python.
Prerequisites
Supported Python Versions
Supported Python Versions
- FastAPI requires Python version 3.7 or higher.
Ensure the Python version specified in your project configuration files (e.g., requirements.txt) matches the version selected during deployment. A mismatch may cause build and runtime errors.
Select Template and Repository

On the dashboard, click or ⌘ + K
to open the deployment modal and select the Python template. Then choose a GitHub repository from the dropdown or input a Git repository URL in the Git URL tab.
Deployment Settings
Apply the following settings to ensure your service runs seamlessly.
Basic Settings
Basic Settings
- Version
- Environment Variables
- Port Number:
8000
(default) - Start Command:
uvicorn main:app --host=0.0.0.0 --port=8000
(default) - Health Check: Endpoint for verifying container status
When entering a start command, refer to the following and modify the arguments according to your source.
More Options
More Options
- Build Variables: Variables to include during container image builds
- Embedded node.js: Node.js version required for builds within the project
- Install Command: Python package installation command
- Pre-start Command: Commands to run before the start command
- Update strategy
- Rolling Update: Deploy new version incrementally while maintaining service availability. Requires sufficient node resources
- Recreate: Stop all instances before deploying new version. Results in downtime
Set Resources and Deploy

- Resource Type: Select between On-demand or Spot instance types
- CPU: Maximum vCPU resource for the service. Minimum vCPU means 0.1 vCPU
- Memory: Maximum memory size your service can use
- Replica: Number of service replicas for high availability and load balancing
-
Deploy: Click
Deploy
Once deployment is complete, you can access the web page via the preview domain or send requests using an API tool.
If deployment fails due to resource limitations, see the Space and Resource Management page to add resources to your space.
FastAPI Docs