You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/app-service/includes/quickstart-python/deploy-cli.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,6 @@ ms.author: charris
4
4
ms.topic: include
5
5
ms.date: 04/01/2022
6
6
---
7
-
Since the `az webapp up` command created the necessary resources and deployed your application in a single step, you can move on to [4 - Browse to the app](#4---browse-to-the-app).
7
+
Since the `az webapp up` command created the necessary resources and deployed your application in a single step, you can move on to the next step.
Copy file name to clipboardExpand all lines: articles/app-service/includes/quickstart-python/deploy-visual-studio-code.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,6 @@ ms.author: charris
4
4
ms.topic: include
5
5
ms.date: 04/01/2022
6
6
---
7
-
Since the previous step created the necessary resources and deployed your application in a single step, you can move on to [4 - Browse to the app](#4---browse-to-the-app).
7
+
Since the previous step created the necessary resources and deployed your application in a single step, you can move on to the next step.
In this quickstart, you'll deploy a Python web app (Djangoor Flask) to [Azure App Service](./overview.md#app-service-on-linux). Azure App Service is a fully managed web hosting service that supports Python apps hosted in a Linux server environment.
16
+
In this quickstart, you deploy a Python web app (Django, Flask, or FastAPI) to [Azure App Service](./overview.md#app-service-on-linux). Azure App Service is a fully managed web hosting service that supports Python apps hosted in a Linux server environment.
17
17
18
18
To complete this quickstart, you need:
19
19
@@ -25,7 +25,7 @@ To complete this quickstart, you need:
25
25
26
26
## 1 - Sample application
27
27
28
-
This quickstart can be completed using either Flaskor Django. A sample application in each framework is provided to help you follow along with this quickstart. Download or clone the sample application to your local workstation.
28
+
This quickstart can be completed using either Flask, Django, or FastAPI. A sample application in each framework is provided to help you follow along with this quickstart. Download or clone the sample application to your local workstation.
1. Browse to the sample application at `http://localhost:8000` in a web browser.
137
+
138
+
:::image type="content" source="./media/quickstart-python/run-django-app-localhost.png" alt-text="Screenshot of the FastAPI app running locally in a browser.":::
139
+
140
+
Having issues? [Let us know](https://aka.ms/PythonAppServiceQuickstartFeedback).
141
+
106
142
---
107
143
108
144
## 2 - Create a web app in Azure
@@ -121,6 +157,7 @@ To create Azure resources in VS Code, you must have the [Azure Tools extension p
@@ -178,7 +215,73 @@ Azure App service supports multiple methods to deploy your application code to A
178
215
179
216
Having issues? Refer first to the [Troubleshooting guide](./configure-language-python.md#troubleshooting), otherwise, [let us know](https://aka.ms/PythonAppServiceQuickstartFeedback).
180
217
181
-
## 4 - Browse to the app
218
+
## 4 - Configure startup script
219
+
220
+
Based on the presence of certain files in a deployment, App Service automatically detects whether an app is a Django or Flask app and performs default steps to run your app. For apps based on other web frameworks like FastAPI, you need to configure a startup script for App Service to run your app; otherwise, App Service runs a default read-only app located in the *opt/defaultsite* folder.
221
+
222
+
To learn more about how App Service runs Python apps and how you can configure and customize its behavior with your app, see [Configure a Linux Python app for Azure App Service](configure-language-python.md).
223
+
224
+
### [Azure CLI](#tab/azure-cli/flask)
225
+
226
+
App Service automatically detects the presence of a Flask app. No additional configuration is needed for this quickstart.
227
+
228
+
### [Azure CLI](#tab/azure-cli/django)
229
+
230
+
App Service automatically detects the presence of a Django app. No additional configuration is needed for this quickstart.
231
+
232
+
### [Azure CLI](#tab/azure-cli/fastapi)
233
+
234
+
For FastAPI, you must configure a custom startup command for App Service to run your app. The following command starts Gunicorn with 2 Uvicorn worker processes: `gunicorn -w 2 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 main:app`.
235
+
236
+
First, configure the startup command using the [az webapp config set](/cli/azure/webapp/config#az-webapp-config-set) command.
Next, restart the web app using the [az webapp restart](/cli/azure/webapp#az-webapp-restart) command.
246
+
247
+
```azurecli
248
+
az webapp restart \
249
+
--name $APP_SERVICE_NAME \
250
+
--resource-group $RESOURCE_GROUP_NAME
251
+
```
252
+
253
+
### [VS Code](#tab/vscode-aztools/flask)
254
+
255
+
App Service automatically detects the presence of a Flask app. No additional configuration is needed for this quickstart.
256
+
257
+
### [VS Code](#tab/vscode-aztools/django)
258
+
259
+
App Service automatically detects the presence of a Django app. No additional configuration is needed for this quickstart.
260
+
261
+
### [VS Code](#tab/vscode-aztools/fastapi)
262
+
263
+
Use Azure CLI or the Azure portal to configure the startup command.
264
+
265
+
### [Azure portal](#tab/azure-portal/flask)
266
+
267
+
App Service automatically detects the presence of a Flask app. No additional configuration is needed for this quickstart.
268
+
269
+
### [Azure portal](#tab/azure-portal/django)
270
+
271
+
App Service automatically detects the presence of a Django app. No additional configuration is needed for this quickstart.
272
+
273
+
### [Azure portal](#tab/azure-portal/fastapi)
274
+
275
+
For FastAPI, you must configure a custom startup command for App Service to run your app. The following command starts Gunicorn with 2 Uvicorn worker processes: `gunicorn -w 2 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 main:app`.
276
+
277
+
| Instructions | Screenshot |
278
+
|:----------------|-----------:|
279
+
|[!INCLUDE [Configure startup command from Azure portal 1](./includes/quickstart-python/configure-startup-azure-portal-1.md)]| :::image type="content" source="./media/quickstart-python/configure-startup-azure-portal-1-240px.png" alt-text="A screenshot of the location in the Azure portal where to configure the startup command." lightbox="./media/quickstart-python/configure-startup-azure-portal-1.png"::: |
280
+
|[!INCLUDE [Configure startup command from Azure portal 2](./includes/quickstart-python/configure-startup-azure-portal-2.md)]| :::image type="content" source="./media/quickstart-python/configure-startup-azure-portal-2-240px.png" alt-text="A screenshot of how to reset the web app in the Azure portal." lightbox="./media/quickstart-python/configure-startup-azure-portal-2.png"::: |
281
+
282
+
---
283
+
284
+
## 5 - Browse to the app
182
285
183
286
Browse to the deployed application in your web browser at the URL `http://<app-name>.azurewebsites.net`. If you see a default app page, wait a minute and refresh the browser.
184
287
@@ -190,18 +293,22 @@ The Python sample code is running a Linux container in App Service using a built
190
293
191
294
Having issues? Refer first to the [Troubleshooting guide](./configure-language-python.md#troubleshooting), otherwise, [let us know](https://aka.ms/PythonAppServiceQuickstartFeedback).
192
295
193
-
## 5 - Stream logs
296
+
## 6 - Stream logs
194
297
195
298
Azure App Service captures all messages output to the console to assist you in diagnosing issues with your application. The sample apps include `print()` statements to demonstrate this capability.
0 commit comments