Skip to content

Commit 2181d32

Browse files
committed
Added gunicorn startup command
1 parent 9467349 commit 2181d32

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

articles/app-service/quickstart-python.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,13 @@ App Service automatically detects the presence of a Django app. No additional co
229229

230230
### [Azure CLI](#tab/azure-cli/fastapi)
231231

232-
For FastAPI, you must configure a custom startup command for App Service to run your app.
232+
For FastAPI, you must configure a custom startup command for App Service to run your app. Set the following command to start Gunicorn with 2 Uvicorn worker processes: `gunicorn -w 2 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 main:app`.
233233

234234
First, configure the startup command using the [az webapp config set](/cli/azure/webapp/config#az-webapp-config-set) command.
235235

236236
```azurecli
237237
az webapp config set \
238-
--startup-file "python main.py" \
238+
--startup-file "gunicorn -w 2 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 main:app" \
239239
--name $APP_SERVICE_NAME \
240240
--resource-group $RESOURCE_GROUP_NAME
241241
```
@@ -270,9 +270,9 @@ App Service automatically detects the presence of a Django app. No additional co
270270

271271
#### [Azure portal](#tab/azure-portal/fastapi)
272272

273-
For FastAPI, you must configure a custom startup command for App Service to run your app.
273+
For FastAPI, you must configure a custom startup command for App Service to run your app. Set the following command to start Gunicorn with 2 Uvicorn worker processes: `gunicorn -w 2 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 main:app`.
274274

275-
First, configure the startup command. Under **Settings**, on the left menu, select the app's **Configuration** page, then select **General settings**. In the **Startup Command** field, enter *python main.py*. Then select **Save** to apply the changes. Wait for the notification that the settings have been updated before proceeding.
275+
First, configure the startup command. Under **Settings**, on the left menu, select the app's **Configuration** page, then select **General settings**. In the **Startup Command** field, enter *gunicorn -w 2 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 main:app*. Then select **Save** to apply the changes. Wait for the notification that the settings have been updated before proceeding.
276276

277277
Next, restart the web app. Select the app's **Overview** page on the left menu. On the top menu, select **Restart**.
278278

0 commit comments

Comments
 (0)