Skip to content

Commit 5560721

Browse files
authored
Merge pull request #102056 from cephalin/django
fix PSlocal run error
2 parents 8001ea2 + d651e23 commit 5560721

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

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

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: 'Tutorial: Linux Python app with Postgre'
33
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.
44
ms.devlang: python
55
ms.topic: tutorial
6-
ms.date: 12/14/2019
6+
ms.date: 01/23/2020
77
ms.custom: [mvc, seodec18, seo-python-october2019]
88
---
99
# Tutorial: Run a Python (Django) web app with PostgreSQL in Azure App Service
@@ -38,6 +38,11 @@ First, connect to your local PostgreSQL server and create a database:
3838
In a local terminal window, run `psql` to connect to your local PostgreSQL server as the built-in `postgres` user.
3939

4040
```bash
41+
sudo su - postgres
42+
psql
43+
```
44+
or
45+
```PowerShell
4146
psql -U postgres
4247
```
4348

@@ -157,23 +162,27 @@ In the following command, replace *\<postgresql-name>* with a unique server name
157162
Replace *\<resourcegroup-name>* and *\<region>* with the name and region of the resource group you want to use. For *\<admin-username>* and *\<admin-password>*, create user credentials for the database administrator account. Remember the *\<admin-username>* and *\<admin-password>* to use later for signing in to the PostgreSQL server and databases.
158163

159164
```azurecli-interactive
160-
az postgres server create --resource-group <resourcegroup-name> --name <postgresql-name> --location "<region>" --admin-user <admin-username> --admin-password <admin-password> --sku-name B_Gen4_1
165+
az postgres server create --resource-group <resourcegroup-name> --name <postgresql-name> --location "<region>" --admin-user <admin-username> --admin-password <admin-password> --sku-name B_Gen5_1
161166
```
162167

163168
When the Azure Database for PostgreSQL server is created, the Azure CLI returns JSON code like the following example:
164169

165170
```json
166171
{
167172
"administratorLogin": "myusername",
173+
"earliestRestoreDate": "2020-01-22T19:02:15.727000+00:00",
168174
"fullyQualifiedDomainName": "myservername.postgres.database.azure.com",
169175
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.DBforPostgreSQL/servers/myservername",
170-
"location": "westus",
176+
"location": "westeurope",
177+
"masterServerId": "",
171178
"name": "myservername",
179+
"replicaCapacity": 5,
180+
"replicationRole": "None",
172181
"resourceGroup": "myresourcegroup",
173182
"sku": {
174183
"capacity": 1,
175-
"family": "Gen4",
176-
"name": "B_Gen4_1",
184+
"family": "Gen5",
185+
"name": "B_Gen5_1",
177186
"size": null,
178187
"tier": "Basic"
179188
},
@@ -267,6 +276,8 @@ Go to *http:\//localhost:8000/admin*, sign in using the admin user you created,
267276

268277
Go to *http:\//localhost:8000* again, and see the poll question displayed. Your app is now writing data to the Azure Database for PostgreSQL database.
269278

279+
To stop the Django server, type Ctrl+C in the terminal.
280+
270281
## Deploy the web app to Azure App Service
271282

272283
In this step, you deploy the Azure Database for PostgreSQL database-connected Python app to Azure App Service.
@@ -344,25 +355,29 @@ For information on how your code accesses these app settings, see [Access enviro
344355
[!INCLUDE [app-service-plan-no-h](../../../includes/app-service-web-git-push-to-azure-no-h.md)]
345356

346357
```bash
347-
Counting objects: 7, done.
358+
Counting objects: 60, done.
348359
Delta compression using up to 8 threads.
349-
Compressing objects: 100% (7/7), done.
350-
Writing objects: 100% (7/7), 775 bytes | 0 bytes/s, done.
351-
Total 7 (delta 4), reused 0 (delta 0)
360+
Compressing objects: 100% (51/51), done.
361+
Writing objects: 100% (60/60), 15.37 KiB | 749.00 KiB/s, done.
362+
Total 60 (delta 9), reused 0 (delta 0)
363+
remote: Deploy Async
352364
remote: Updating branch 'master'.
353365
remote: Updating submodules.
354-
remote: Preparing deployment for commit id '6520eeafcc'.
355-
remote: Generating deployment script.
356-
remote: Running deployment command...
357-
remote: Python deployment.
358-
remote: Kudu sync from: '/home/site/repository' to: '/home/site/wwwroot'
366+
remote: Preparing deployment for commit id '06f3f7c0cb'.
367+
remote: Repository path is /home/site/repository
368+
remote: Running oryx build...
369+
remote: Build orchestrated by Microsoft Oryx, https://github.com/Microsoft/Oryx
370+
remote: You can report issues at https://github.com/Microsoft/Oryx/issues
359371
.
360372
.
361373
.
374+
remote: Done in 100 sec(s).
375+
remote: Running post deployment command(s)...
376+
remote: Triggering recycle (preview mode disabled).
362377
remote: Deployment successful.
363-
remote: App container will begin restart within 10 seconds.
378+
remote: Deployment Logs : 'https://<app-name>.scm.azurewebsites.net/newui/jsonviewer?view_url=/api/deployments/06f3f7c0cb52ce3b4aff85c2b5099fbacb65ab94/log'
364379
To https://<app-name>.scm.azurewebsites.net/<app-name>.git
365-
06b6df4..6520eea master -> master
380+
* [new branch] master -> master
366381
```
367382

368383
The App Service deployment server sees *requirements.txt* in the repository root and runs Python package management automatically after `git push`.

0 commit comments

Comments
 (0)