- This sample application demonstrates how to implement SSE (Server-Sent Events) in Azure Functions.
- The UI code has been created using Chainlit.
- The backend is developed using the Azure Function App Python SDK.
- The SDK and implementation use Azure Function Programming model v2.
- azure:
https://<APP_NAME>.azurewebsites.net/api/<FUNCTION_NAME>
- local:
http://localhost:<PORT>/api/<FUNCTION_NAME>
-
Install the Azure Functions Core Tools & Visual Code : Azure Extension
-
Rename
local.settings.template.json
tolocal.settings.json
- Fill your values inlocal.settings.json
-
The command must be run in a virtual environment.
- Functions:
func start
- UI application:
chainlit run ui_app.py -w
- Functions:
-
[Optional] Change venv path > .vscode > settings.json > "azureFunctions.pythonVenv": "venv"
- cmd:
func azure functionapp publish <FunctionAppName>
- Azure Functions: Support for HTTP Streams in Python is now in Preview!
- When deploying, add the following application settings: "PYTHON_ENABLE_INIT_INDEXING": "1". If you are deploying to Linux Consumption, also add "PYTHON_ISOLATE_WORKER_DEPENDENCIES": "1". When running locally, you also need to add these same settings to the local.settings.json project file.