Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
To host a Python web app folder on Azure so others can view it, use Azure App Service and deploy the code as a web app.
- Prepare the Python app
- Ensure the folder is a web app using a framework like Django, Flask, or FastAPI.
- Add a
requirements.txtfile listing all Python packages.
- Create the web app in Azure (one-time)
- Install the Azure CLI on the local machine.
- In a terminal, go to the Python project folder.
- Sign in:
az login - Create and deploy the web app in one step:
az webapp up --runtime PYTHON:3.14 --sku B1 --logs - When the command finishes, it prints the web app URL. That URL is what people can use to view the app.
- Update and redeploy later
- After changing the Python code, from the same project folder run:
az webapp up - The command re-deploys the updated folder to the same web app.
- After changing the Python code, from the same project folder run:
- Alternative: zip deploy
- Create a ZIP file of the Python project (excluding virtual environments and hidden folders).
- Enable build automation on the web app by setting the
SCM_DO_BUILD_DURING_DEPLOYMENTapp setting totruein the Azure portal or with Azure CLI. - Deploy the ZIP file:
az webapp deploy \ --name <app-service-name> \ --resource-group <resource-group-name> \ --src-path <zip-file-path> - Share the web app URL with users.
These steps host the Python folder as a web application on Azure App Service so it can be accessed over the internet.
References: