Skip to content

Commit

Permalink
Merge branch 'azd-support' of https://github.com/pamelafox/fastapi-on…
Browse files Browse the repository at this point in the history
…-azure-functions into azd-support
  • Loading branch information
pamelafox committed Feb 24, 2023
2 parents 876105e + e3b9220 commit 95b7434
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"tasks": [
{
"type": "func",
"label": "func: host start",
"command": "host start",
"problemMatcher": "$func-python-watch",
"isBackground": true,
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Clone or download [this sample's repository](https://github.com/Azure-Samples/fa

The code in the sample folder has already been updated to support use of the FastAPI. Let's walk through the changed files.

The `requirements.txt` file has an additional dependency of the `fastapi` and `nest_asyncio` modules:
The `requirements.txt` file has an additional dependency of the `fastapi` module:

```
azure-functions
Expand Down Expand Up @@ -111,7 +111,7 @@ async def main(req: func.HttpRequest, context: func.Context) -> func.HttpRespons
First run the command below to install the necessary requirements.

```log
pip3 install -r requirements.txt
python3 -m pip install -r requirements.txt
```

If you are using VS Code for development, follow [the instructions for running a function locally](https://docs.microsoft.com/azure/azure-functions/create-first-function-vs-code-python#run-the-function-locally). Otherwise, follow [these instructions for using Core Tools commands directly to run the function locally](https://docs.microsoft.com/azure/azure-functions/functions-run-local?tabs=v4%2Cwindows%2Cpython%2Cportal%2Cbash#start).
Expand All @@ -130,9 +130,15 @@ http://localhost:7071/sample
http://localhost:7071/hello/YourName
```

### Testing in Azure
### Deploying to Azure

There are three main ways to deploy this to Azure:

If you are using VS Code for development, follow [these instructions for using the extension to create resources and deploying to Azure](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-python#publish-the-project-to-azure). Otherwise, follow [these instructions for using the Azure CLI to create resources and deploy to Azure](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-python?tabs=azure-cli%2Cbash%2Cbrowser#create-supporting-azure-resources-for-your-function).
* [Deploy with the VS Code Azure Functions extension](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-python#publish-the-project-to-azure).
* [Deploy with the Azure CLI](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-python?tabs=azure-cli%2Cbash%2Cbrowser#create-supporting-azure-resources-for-your-function).
* Deploy with the Azure Developer CLI: After [installing the `azd` tool](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd?tabs=localinstall%2Cwindows%2Cbrew), run `azd up` in the root of the project. You can also run `azd pipeline config` to set up a CI/CD pipeline for deployment.

### Testing in Azure

Once deployed, test different paths on the deployed URL, using either a browser or a tool like Postman.

Expand Down

0 comments on commit 95b7434

Please sign in to comment.