Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ __pycache__/
*$py.class

# Azure Functions
local.settings.json

# Distribution / packaging
.Python
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"azureFunctions.projectLanguage": "Python",
"azureFunctions.projectRuntime": "~4",
"debug.internalConsoleOptions": "neverOpen",
"azureFunctions.projectLanguageModel": 2
"azureFunctions.projectLanguageModel": 2,
"githubPullRequests.ignoredPullRequestBranches": [
"main"
]
}
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This source code supports the article [Quickstart: Create and deploy functions t
## Prerequisites

+ [Python 3.11](https://www.python.org/)
+ [Azurite](https://learn.microsoft.com/azure/storage/common/storage-use-azurite) (for local storage emulation)
+ [Azure Functions Core Tools](https://learn.microsoft.com/azure/azure-functions/functions-run-local?pivots=programming-language-python#install-the-azure-functions-core-tools)
+ [Azure Developer CLI (AZD)](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd)
+ To use Visual Studio Code to run and debug locally:
Expand All @@ -46,24 +47,15 @@ You can initialize a project from this `azd` template in one of these ways:

```shell
git clone https://github.com/Azure-Samples/functions-quickstart-python-http-azd.git
cd functions-quickstart-python-azd
cd functions-quickstart-python-http-azd
```

You can also clone the repository from your own fork in GitHub.

## Prepare your local environment
## Local settings

Add a file named `local.settings.json` in the root of your project with the following contents:
The `local.settings.json` file is included in this template with default values for local development. This file is excluded from deployment by `.funcignore`.

```json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "python"
}
}
```

## Create a virtual environment

Expand All @@ -86,7 +78,13 @@ py -m venv .venv

## Run your app from the terminal

1. To start the Functions host locally, run these commands in the virtual environment:
1. Start Azurite for local storage emulation. In a separate terminal, run:

```shell
azurite
```

1. In your project terminal, start the Functions host:

```shell
pip3 install -r requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module api './app/api.bicep' = {
applicationInsightsName: monitoring.outputs.name
appServicePlanId: appServicePlan.outputs.resourceId
runtimeName: 'python'
runtimeVersion: '3.12'
runtimeVersion: '3.13'
storageAccountName: storage.outputs.name
enableBlob: storageEndpointConfig.enableBlob
enableQueue: storageEndpointConfig.enableQueue
Expand Down
7 changes: 7 additions & 0 deletions local.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "python"
}
}
4 changes: 2 additions & 2 deletions test.http
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ GET http://localhost:7071/api/httpget?name=World HTTP/1.1

###

POST http://localhost:7071/api/httppost HTTP/1.1
POST http://localhost:7071/api/httppost
content-type: application/json

{
"name": "Awesome Developer",
"age": 25
}
}