Skip to content

Commit 4369fb9

Browse files
committed
Postgres tutorial
1 parent c80b147 commit 4369fb9

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

articles/app-service/tutorial-python-postgresql-app.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ In this tutorial, you'll deploy a data-driven Python web app (**[Django](https:/
1515

1616
**To complete this tutorial, you'll need:**
1717

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).
1919
* Knowledge of Python with Flask development or [Python with Django development](/training/paths/django-create-data-driven-websites/)
2020

2121
## Sample application
2222

2323
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.
2424

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:
2626

2727
### [Flask](#tab/flask)
2828

@@ -38,9 +38,11 @@ git clone https://github.com/Azure-Samples/msdocs-django-postgresql-sample-app.g
3838

3939
-----
4040

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.
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.
4243

4344
```
45+
FLASK_DEBUG=True
4446
DBNAME=<database name>
4547
DBHOST=<database-hostname>
4648
DBUSER=<db-user-name>
@@ -115,8 +117,8 @@ Sign in to the [Azure portal](https://portal.azure.com/) and follow these steps
115117
1. *Region* &rarr; Any Azure region near you.
116118
1. *Name* &rarr; **msdocs-python-postgres-XYZ** where *XYZ* is any three random characters. This name must be unique across Azure.
117119
1. *Runtime stack* &rarr; **Python 3.9**.
120+
1. *Database* &rarr; **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.
118121
1. *Hosting plan* &rarr; **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.
120122
1. Select **Review + create**.
121123
1. After validation completes, select **Create**.
122124
:::column-end:::
@@ -216,6 +218,7 @@ In this step, you'll configure GitHub deployment using GitHub Actions. It's just
216218
1. In **Organization**, select your account.
217219
1. In **Repository**, select **msdocs-flask-postgresql-sample-app**.
218220
1. In **Branch**, select **main**.
221+
1. Keep the default option selected to **Add a workflow**.
219222
1. In the top menu, select **Save**. App Service commits a workflow file into the chosen GitHub repository, in the `.github/workflows` directory.
220223
:::column-end:::
221224
:::column:::
@@ -321,7 +324,7 @@ Having issues? Refer first to the [Troubleshooting guide](configure-language-pyt
321324

322325
### [Flask](#tab/flask)
323326

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.
325328

326329
:::row:::
327330
:::column span="2":::
@@ -384,7 +387,7 @@ Having issues? [Let us know](https://aka.ms/DjangoCLITutorialHelp).
384387
:::row-end:::
385388
:::row:::
386389
:::column span="2":::
387-
**Step 2.** Add a few tasks to the list.
390+
**Step 2.** Add a few restaurants to the list.
388391
Congratulations, you're running a secure data-driven Flask app in Azure App Service, with connectivity to Azure Database for PostgreSQL.
389392
:::column-end:::
390393
:::column:::
@@ -413,6 +416,7 @@ Azure App Service captures all messages output to the console to help you diagno
413416
**Step 1.** In the App Service page:
414417
1. From the left menu, select **App Service logs**.
415418
1. Under **Application logging**, select **File System**.
419+
1. In the top menu, select **Save**.
416420
:::column-end:::
417421
:::column:::
418422
:::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).
475479

476480
#### How much does this setup cost?
477481

478-
Pricing for the create resources is as follows:
482+
Pricing for the created resources is as follows:
479483

480484
- 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/).
481485
- 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:
490494

491495
#### How does local app development work with GitHub Actions?
492496

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:
494498

495499
```terminal
496500
git add .

0 commit comments

Comments
 (0)