Deploy Command
The fastapi deploy command deploys your FastAPI application to FastAPI Cloud. 🚀
This is the main command you’ll use to get your application running in the cloud.
fastapi deploy [PATH]Arguments:
[PATH]- Optional. A path to the folder containing the app you want to deploy. If not provided, it will deploy the current directory.
Options:
--no-wait- Skip waiting for deployment status and return immediately after upload
What Happens When You Deploy
Section titled “What Happens When You Deploy”When you run fastapi deploy, the CLI will:
- Package and upload your application code to FastAPI Cloud
- Your app is installed and built in the cloud
- Your app is deployed with zero downtime
- The deployment is verified
You can read more about how this works in the How It Works documentation.
First Time Deploying
Section titled “First Time Deploying”The first time you run fastapi deploy, if you’re not logged in yet, you’ll be prompted to log in.
After logging in, the CLI will help you set up your deployment:
- Select or create a team
- Choose to create a new app or link to an existing one
After your first deployment, a .fastapicloud directory will be created in your project. This will contain your app configuration and link your local project to the cloud deployment.
Deploying Updates
Section titled “Deploying Updates”Once you’ve deployed your app for the first time, the subsequent deployments are simple.
Just run fastapi deploy again from the same directory.
The CLI will:
- Use the existing configuration in
.fastapicloud - Package and upload your updated code
Then, the cloud will handle the rest.
Important Notes
Section titled “Important Notes”By default, the command respects .gitignore files when packaging your application.
You can customize what gets uploaded with a .fastapicloudignore file. Read more in the Ignore or Un-ignore Files documentation.
Troubleshooting
Section titled “Troubleshooting”Error: App not found
Section titled “Error: App not found”If you see this error during deployment:
App not found. Make sure you're logged in the correct account.This usually means:
- You’re logged in with a different account than the one that created the app
- The app was deleted from the dashboard
If you deleted the app, you can run fastapi unlink to remove the local configuration and deploy as a new app. You can read more in the Unlink Command documentation.
Error: No credentials found
Section titled “Error: No credentials found”You need to log in first:
fastapi loginThen try deploying again.
Related Commands
Section titled “Related Commands”fastapi login- Log in to FastAPI Cloudfastapi cloud unlink- Remove the local.fastapicloudconfigurationfastapi cloud env set- Set environment variables for your app