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/containers/tutorial-python-postgresql-app.md
+13-21Lines changed: 13 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,21 @@
1
1
---
2
-
title: 'Tutorial: Build a Python Django web app with PostgreSQL in Azure App Service'
3
-
description: Learn how to run a PostgreSQL database-driven Python Django web app in Azure.
4
-
services: app-service\web
5
-
documentationcenter: python
6
-
author: cephalin
7
-
manager: gwallace
8
-
ms.service: app-service-web
9
-
ms.workload: web
2
+
title: 'Tutorial: Linux Python app with Postgre'
3
+
description: Learn how to get a Linux Python app working in Azure App Service, with connection to a PostgreSQL database in Azure. Django is used in this tutorial.
# Tutorial: Run a Python Django web app with PostgreSQL in Azure App Service
9
+
# Tutorial: Run a Python (Django) web app with PostgreSQL in Azure App Service
17
10
18
-
[Azure App Service](app-service-linux-intro.md) provides a highly scalable, self-patching web hosting service. [Azure Database for PostgreSQL](/azure/postgresql/overview) is a relational database service based on the open-source PostgreSQL database engine. This tutorial shows how to connect a data-driven Python Django web app to an Azure Database for PostgreSQL database, and deploy and run the app on Azure App Service.
11
+
[Azure App Service](app-service-linux-intro.md) provides a highly scalable, self-patching web hosting service. This tutorial shows how to connect a data-driven Python Django web app to an Azure Database for PostgreSQL database, and deploy and run the app on Azure App Service.
19
12
20
13

21
14
22
15
In this tutorial, you learn how to:
23
16
24
17
> [!div class="checklist"]
25
-
> * Connect a Python Django web app to a local PostgreSQL database
26
-
> * Create an Azure Database for PostgreSQL database and connect the web app to it
18
+
> * Create an Azure Database for PostgreSQL database and connect a web app to it
- Install and run [PostgreSQL](https://www.postgresql.org/download/).
41
33
42
-
## Create a local PostgreSQL database
34
+
## Test PostgreSQL installation and create a database
43
35
44
36
First, connect to your local PostgreSQL server and create a database:
45
37
@@ -49,7 +41,7 @@ In a local terminal window, run `psql` to connect to your local PostgreSQL serve
49
41
psql -U postgres
50
42
```
51
43
52
-
If the connection isn't successful, make sure your PostgreSQL server is running, or restart it if necessary.
44
+
If your connection is successful, your PostgreSQL database is running. If not, make sure that your local PostgresQL database is started by following the instructions for your operating system at [Downloads - PostgreSQL Core Distribution](https://www.postgresql.org/download/).
53
45
54
46
Create a new database called *pollsdb*, and set up a database user named *manager* with password *supersecretpass*:
55
47
@@ -62,11 +54,11 @@ GRANT ALL PRIVILEGES ON DATABASE pollsdb TO manager;
62
54
Type `\q` to exit the PostgreSQL client.
63
55
64
56
<aname="step2"></a>
65
-
## Create and run the Python app
57
+
## Create and run the local Python app
66
58
67
59
Next, set up and run the sample Python Django web app.
68
60
69
-
The [djangoapp](https://github.com/Azure-Samples/djangoapp) sample repository contains the data-driven [Django](https://www.djangoproject.com/) polls app you get by following [Writing your first Django app](https://docs.djangoproject.com/en/2.1/intro/tutorial01/) in the Django documentation. You can connect this, or any other data-driven Python Django web app, to a local or cloud PostgreSQL database back end.
61
+
The [djangoapp](https://github.com/Azure-Samples/djangoapp) sample repository contains the data-driven [Django](https://www.djangoproject.com/) polls app you get by following [Writing your first Django app](https://docs.djangoproject.com/en/2.1/intro/tutorial01/) in the Django documentation.
70
62
71
63
### Clone the sample app
72
64
@@ -126,7 +118,7 @@ System check identified no issues (0 silenced).
126
118
December 13, 2019 - 10:54:59
127
119
Django version 2.1.2, using settings 'azuresite.settings'
128
120
Starting development server at http://127.0.0.1:8000/
129
-
Quit the server with CTRL-BREAK.
121
+
Quit the server with CONTROL-C.
130
122
```
131
123
132
124
Go to *http:\//localhost:8000* in a browser. You should see the message **No polls are available**.
@@ -281,7 +273,7 @@ In this step, you deploy the Azure Database for PostgreSQL database-connected Py
281
273
282
274
### Configure repository
283
275
284
-
You need to change and add some settings in your *djangoapp/azuresite/settings.py* file to work with Azure App Service.
276
+
Because this tutorial uses a Django sample, you need to change and add some settings in your *djangoapp/azuresite/settings.py* file to work with Azure App Service.
285
277
286
278
1. Django validates the `HTTP_HOST` header in incoming requests. For your Django web app to work in App Service, you need to add the fully qualified domain name of the app to the allowed hosts.
287
279
@@ -321,7 +313,7 @@ Commit your changes into your fork of the *djangoapp* repository:
@@ -399,7 +391,7 @@ In the [Azure portal](https://portal.azure.com), search for and select the app y
399
391
400
392

401
393
402
-
By default, the portal shows your app's **Overview** page. This page gives you a view of how your app is doing. Here, you can also perform basic management tasks like browse, stop, swap, restart, and delete. The tabs on the left side of the page show the different configuration pages you can open.
394
+
By default, the portal shows your app's **Overview** page. This page gives you a view of how your app is doing. Here, you can also perform basic management tasks like browse, stop, restart, and delete. The tabs on the left side of the page show the different configuration pages you can open.
403
395
404
396

Copy file name to clipboardExpand all lines: includes/app-service-web-create-app-service-plan-linux-no-h.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,18 +5,18 @@ services: app-service
5
5
author: cephalin
6
6
ms.service: app-service
7
7
ms.topic: "include"
8
-
ms.date: 10/24/2018
8
+
ms.date: 12/20/2019
9
9
ms.author: cephalin
10
10
ms.custom: "include file"
11
11
---
12
12
In the Cloud Shell, create an App Service plan in the resource group with the [`az appservice plan create`](/cli/azure/appservice/plan?view=azure-cli-latest#az-appservice-plan-create) command.
The following example creates an App Service plan named `myAppServicePlan` in the **Basic** pricing tier (`--sku B1`) and in a Linux container (`--is-linux`).
16
+
The following example creates an App Service plan named `myAppServicePlan` in the **Free** pricing tier (`--sku F1`) and in a Linux container (`--is-linux`).
17
17
18
18
```azurecli-interactive
19
-
az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --sku B1 --is-linux
19
+
az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --sku F1 --is-linux
20
20
```
21
21
22
22
When the App Service plan has been created, the Azure CLI shows information similar to the following example:
Copy file name to clipboardExpand all lines: includes/app-service-web-git-push-to-azure-no-h.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,13 @@ ms.author: cephalin
10
10
ms.custom: "include file"
11
11
---
12
12
13
-
Back in the _local terminal window_, add an Azure remote to your local Git repository. Replace _<deploymentLocalGitUrl-from-create-step>_ with the URL of the Git remote that you saved from [Create a web app](#create-a-web-app).
13
+
Back in the local terminal window, add an Azure remote to your local Git repository. Replace *\<deploymentLocalGitUrl-from-create-step>* with the URL of the Git remote that you saved from [Create a web app](#create-a-web-app).
Push to the Azure remote to deploy your app with the following command. When prompted for credentials by Git Credential Manager, make sure that you enter the credentials you created in Configure a deployment user, not the credentials you use to sign in to the Azure portal.
19
+
Push to the Azure remote to deploy your app with the following command. When Git Credential Manager prompts you for credentials, make sure that you enter the credentials you created in [Configure a deployment user](#configure-a-deployment-user), not the credentials you use to sign in to the Azure portal.
0 commit comments