Closed zmoog closed 1 year ago
I am following the steps at https://learn.microsoft.com/en-us/azure/app-service/quickstart-python
Clone, set up, and run the web app my local machine:
git clone https://github.com/Azure-Samples/msdocs-python-flask-webapp-quickstart
cd msdocs-python-flask-webapp-quickstart
python -m venv venv
. venv/bin/activate
pip install -r requirements.txt
$ flask run
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
Run the app on Azure as an App Service.
The --logs
is crucial for our purpose (app services logs):
flag configures default logging required to enable viewing the log stream immediately after launching the webapp.
Pick the correct region (especially if you want to use an event hub for logs delivery):
$ az appservice list-locations --sku B1
[
{
"name": "East US"
},
{
"name": "North Europe"
},
{
"name": "West Europe"
},
{
"name": "Southeast Asia"
},
{
"name": "East Asia"
},
{
"name": "West US"
},
{
"name": "Japan West"
},
{
"name": "Japan East"
},
{
"name": "East US 2"
},
{
"name": "North Central US"
},
{
"name": "South Central US"
},
{
"name": "Brazil South"
},
{
"name": "Australia East"
},
{
"name": "Australia Southeast"
},
{
"name": "Central US"
},
{
"name": "Central India"
},
{
"name": "West India"
},
{
"name": "South India"
},
{
"name": "Canada Central"
},
{
"name": "Canada East"
},
{
"name": "West Central US"
},
{
"name": "West US 2"
},
{
"name": "UK West"
},
{
"name": "UK South"
},
{
"name": "Korea South"
},
{
"name": "Korea Central"
},
{
"name": "France Central"
},
{
"name": "Australia Central"
},
{
"name": "South Africa North"
},
{
"name": "Switzerland North"
},
{
"name": "Germany West Central"
},
{
"name": "UAE North"
},
{
"name": "Norway East"
},
{
"name": "West US 3"
},
{
"name": "Sweden Central"
},
{
"name": "Qatar Central"
}
]
I am picking Using "Germany West Central"
because I already have an event hub there."East US"
due to lack of SKU availability in "Germany West Central"
.
az login --tenant <YOUR TENAND ID>
$ az webapp up --runtime PYTHON:3.9 --sku B1 --logs --location "East US" --name mbranca-app
The webapp 'mbranca-app' doesn't exist
Creating Resource group 'maurizio.branca_rg_3838' ...
Resource group creation complete
Creating AppServicePlan 'maurizio.branca_asp_1619' ...
Creating webapp 'mbranca-app' ...
Configuring default logging for the app, if not already enabled
Creating zip with contents of dir /Users/zmoog/code/projects/zmoog/msdocs-python-flask-webapp-quickstart ...
Getting scm site credentials for zip deployment
Starting zip deployment. This operation can take a while to complete ...
Deployment endpoint responded with status code 202
You can launch the app at http://mbranca-app.azurewebsites.net
Configuring default logging for the app, if not already enabled
2023-02-26T09:09:43 Welcome, you are now connected to log-streaming service.
The app is up and running on Azure at https://mbranca-app.azurewebsites.net
For this research, I'll use the sample app https://github.com/Azure-Samples/msdocs-python-flask-webapp-quickstart from Microsoft.
Refs: