网页
综合
更新时间 2026-11-14 05:18:20
Quick Start | FastAPI Cloud Docs
自动蜘蛛
fastapicloud.com
正文约 2051 字
Get your FastAPI application deployed in minutes with FastAPI Cloud! This guide will walk you through creating and deploying your first app.
There are two ways to get started: using fastapi-new for a quick setup, or manually setting up your project if you prefer more control.
Create a new FastAPI project with a single command:
This will create a new directory with a complete project structure, including a basic sample FastAPI application and project configuration. It will also add fastapi[standard] as a dependency, which includes the FastAPI Cloud CLI needed for deployment.
By default, fastapi-new uses the global Python version you’ve pinned with uv. To specify a different Python version for your project, use the -p/--python option:
If you are using uv, you can skip activating the virtual environment and prefix commands with uv run instead (e.g., uv run fastapi dev, uv run fastapi deploy).
Activate the virtual environment:
If you prefer to set up your project manually, follow these steps:
Step 1: Initialize Your Project
Activate the virtual environment:
Step 2: Install FastAPI
The fastapi[standard] dependency group includes the FastAPI Cloud CLI, which provides the fastapi login and fastapi deploy commands.
Step 3: Create Your App
Create a file named main.py with this code:
Deploy your application with a single command:
The CLI will automatically detect your FastAPI application and deploy it to the cloud. If you are not logged in, you will be prompted to do so, and your browser will open to complete the authentication process.
🚀 Your app is now live: https://myapp.fastapicloud.dev
You can also deploy your application directly from your editor using the Deploy Application command in the FastAPI extension. See Editor Support.
FastAPI automatically generates interactive API documentation. Visit your app’s /docs endpoint to explore the API:
If you run into any issues, see Troubleshooting.
Check your application logs in the FastAPI Cloud dashboard:
You’ve successfully deployed your first FastAPI application to the cloud.
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。