https://github.com/lionello/fastapi
https://github.com/lionello/fastapi
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lionello/fastapi
- Owner: lionello
- Created: 2024-11-29T22:21:57.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-29T22:27:12.000Z (about 1 year ago)
- Last Synced: 2024-11-29T23:24:17.200Z (about 1 year ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FastAPI
[](https://portal.defang.dev/redirect?url=https%3A%2F%2Fgithub.com%2Fnew%3Ftemplate_name%3Dsample-fastapi-template%26template_owner%3DDefangSamples)
This sample project demonstrates how to deploy FastAPI with Defang.
## Prerequisites
1. Download [Defang CLI](https://github.com/DefangLabs/defang)
2. (Optional) If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc) authenticate with your cloud provider account
3. (Optional for local development) [Docker CLI](https://docs.docker.com/engine/install/)
## Development
To run the application locally, you can use the following command:
```bash
docker compose -f compose.yaml -f compose.dev.yaml up --build
```
## Configuration
For this sample, you will not need to provide [configuration](https://docs.defang.io/docs/concepts/configuration).
If you wish to provide configuration, see below for an example of setting a configuration for a value named `API_KEY`.
```bash
defang config set API_KEY
```
## Deployment
> [!NOTE]
> Download [Defang CLI](https://github.com/DefangLabs/defang)
### Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
```bash
defang compose up
```
### BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
1. [Authenticate your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), and check that you have properly set your environment variables like `AWS_PROFILE`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`.
2. Run in a terminal that has access to your AWS environment variables:
```bash
defang --provider=aws compose up
```
---
Title: FastAPI
Short Description: A sample project demonstrating how to deploy FastAPI with Defang.
Tags: FastAPI, OpenAPI, Python
Languages: python