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/tutorial-python-postgresql-app.md
+12-8Lines changed: 12 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,14 +15,14 @@ In this tutorial, you'll deploy a data-driven Python web app (**[Django](https:/
15
15
16
16
**To complete this tutorial, you'll need:**
17
17
18
-
* An Azure account with an active subscription exists. If you don't have an Azure account, you [can create one for free](https://azure.microsoft.com/free/python).
18
+
* An Azure account with an active subscription. If you don't have an Azure account, you [can create one for free](https://azure.microsoft.com/free/python).
19
19
* Knowledge of Python with Flask development or [Python with Django development](/training/paths/django-create-data-driven-websites/)
20
20
21
21
## Sample application
22
22
23
23
Sample Python applications using the Flask and Django framework are provided to help you follow along with this tutorial. To deploy them without running them locally, skip this part.
24
24
25
-
To run the application locally, make sure you have [Python 3.7 or higher](https://www.python.org/downloads/) and [PostgreSQL](https://www.postgresql.org/download/)install locally. Then, download or clone the app:
25
+
To run the application locally, make sure you have [Python 3.7 or higher](https://www.python.org/downloads/) and [PostgreSQL](https://www.postgresql.org/download/)installed locally. Then, download or clone the app:
Create an *.env* file as shown below using the *.env.sample* file as a guide. Set the value of `DBNAME` to the name of an existing database in your local PostgreSQL instance. Set the values of `DBHOST`, `DBUSER`, and `DBPASS` as appropriate for your local PostgreSQL instance.
41
+
Create an *.env* file as shown below using the *.env.sample* file as a guide. Set the value of `DBNAME` to the name of an existing database in your local PostgreSQL instance. Set the values of `DBHOST`, `DBUSER`, and `DBPASS` as appropriate for your local PostgreSQL instance. The `FLASK_DEBUG` environment variable is optional
42
+
and used to enable debug mode in Flask.
42
43
43
44
```
45
+
FLASK_DEBUG=True
44
46
DBNAME=<database name>
45
47
DBHOST=<database-hostname>
46
48
DBUSER=<db-user-name>
@@ -115,8 +117,8 @@ Sign in to the [Azure portal](https://portal.azure.com/) and follow these steps
115
117
1. *Region*→ Any Azure region near you.
116
118
1. *Name*→**msdocs-python-postgres-XYZ** where *XYZ* is any three random characters. This name must be unique across Azure.
117
119
1. *Runtime stack*→**Python 3.9**.
120
+
1. *Database*→**PostgreSQL - Flexible Server** is selected by default as the database engine. The server name and database name is also set by default to appropriate values.
118
121
1. *Hosting plan*→**Basic**. When you're ready, you can [scale up](manage-scale-up.md) to a production pricing tier later.
119
-
1. **PostgreSQL - Flexible Server** is selected by default as the database engine.
120
122
1. Select **Review + create**.
121
123
1. After validation completes, select **Create**.
122
124
:::column-end:::
@@ -216,6 +218,7 @@ In this step, you'll configure GitHub deployment using GitHub Actions. It's just
216
218
1. In **Organization**, select your account.
217
219
1. In **Repository**, select **msdocs-flask-postgresql-sample-app**.
218
220
1. In **Branch**, select **main**.
221
+
1. Keep the default option selected to **Add a workflow**.
219
222
1. In the top menu, select **Save**. App Service commits a workflow file into the chosen GitHub repository, in the `.github/workflows` directory.
220
223
:::column-end:::
221
224
:::column:::
@@ -321,7 +324,7 @@ Having issues? Refer first to the [Troubleshooting guide](configure-language-pyt
321
324
322
325
### [Flask](#tab/flask)
323
326
324
-
With the PostgreSQL database protected by the virtual network, the easiest way to run Run [Flask database migrations](https://flask-migrate.readthedocs.io/en/latest/) is in an SSH session with the App Service container.
327
+
With the PostgreSQL database protected by the virtual network, the easiest way to run [Flask database migrations](https://flask-migrate.readthedocs.io/en/latest/) is in an SSH session with the App Service container.
325
328
326
329
:::row:::
327
330
:::column span="2":::
@@ -384,7 +387,7 @@ Having issues? [Let us know](https://aka.ms/DjangoCLITutorialHelp).
384
387
:::row-end:::
385
388
:::row:::
386
389
:::column span="2":::
387
-
**Step 2.** Add a few tasks to the list.
390
+
**Step 2.** Add a few restaurants to the list.
388
391
Congratulations, you're running a secure data-driven Flask app in Azure App Service, with connectivity to Azure Database for PostgreSQL.
389
392
:::column-end:::
390
393
:::column:::
@@ -413,6 +416,7 @@ Azure App Service captures all messages output to the console to help you diagno
413
416
**Step 1.** In the App Service page:
414
417
1. From the left menu, select **App Service logs**.
415
418
1. Under **Application logging**, select **File System**.
419
+
1. In the top menu, select **Save**.
416
420
:::column-end:::
417
421
:::column:::
418
422
:::image type="content" source="./media/tutorial-python-postgresql-app/azure-portal-stream-diagnostic-logs-1.png" alt-text="A screenshot showing how to enable native logs in App Service in the Azure portal." lightbox="./media/tutorial-python-postgresql-app/azure-portal-stream-diagnostic-logs-1.png":::
@@ -475,7 +479,7 @@ Having issues? [Let us know](https://aka.ms/DjangoCLITutorialHelp).
475
479
476
480
#### How much does this setup cost?
477
481
478
-
Pricing for the create resources is as follows:
482
+
Pricing for the created resources is as follows:
479
483
480
484
- The App Service plan is created in **Basic** tier and can be scaled up or down. See [App Service pricing](https://azure.microsoft.com/pricing/details/app-service/linux/).
481
485
- The PostgreSQL flexible server is create in the lowest burstable tier **Standard_B1ms**, with the minimum storage size, which can be scaled up or down. See [Azure Database for PostgreSQL pricing](https://azure.microsoft.com/pricing/details/postgresql/flexible-server/).
@@ -490,7 +494,7 @@ Pricing for the create resources is as follows:
490
494
491
495
#### How does local app development work with GitHub Actions?
492
496
493
-
Take the autogenerated workflow file from App Service as an example, each `git push` kicks off a new build and deployment run. From a local clone of the GitHub repository, you make the desired updates push it to GitHub. For example:
497
+
Using the autogenerated workflow file from App Service as an example, each `git push` kicks off a new build and deployment run. From a local clone of the GitHub repository, you make the desired updates and push to GitHub. For example:
0 commit comments