Deploy Python FastAPI serverless application on Azure Functions.
- Good project structure
# create virtual environment
python3 -m venv .azure_function_fastapi_venv
# activate virtual environment
source .azure_function_fastapi_venv/bin/activate
# install packages
pip3 install -r requirements.txt
# run project with uvicorn
uvicorn "fastapi_project.main:app" --reload --port=8000
# or, run bash with shell
./run_fastapi_project.sh
![Screenshot 2024-05-19 at 5 50 24 PM](https://private-user-images.githubusercontent.com/17185462/331869160-6ed26cba-70d8-4c76-8518-5c0b20eaf281.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ4NTMxMjUsIm5iZiI6MTcyNDg1MjgyNSwicGF0aCI6Ii8xNzE4NTQ2Mi8zMzE4NjkxNjAtNmVkMjZjYmEtNzBkOC00Yzc2LTg1MTgtNWMwYjIwZWFmMjgxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI4VDEzNDcwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYyZWM4NDRjZTdiNjNmYjA4ZjBmYzFlZjM4OTcwN2FjMTJmMTdjOTdhY2Q4MTZhZjZhOWU4NzdiYzVmYjg1NDUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.t8kHidQTHA5SyIqGfIC6TIOfHg2c8l1R2qzKt1epiis)
set the environment variable azure (Settings >> Environment variables (app settings))
DATABASE_URL
LOAD_SQL_PROJECT
value will beyes
https://localhost:8000/api/v1/users
https://localhost:8000/health