Skip to content

Commit f29f71e

Browse files
committed
add update content
1 parent ba0d75e commit f29f71e

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

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

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,19 +340,44 @@ To stop the Django server, type Ctrl+C.
340340

341341
### Update the app
342342

343-
TODO HERE
343+
Just to see how making app updates works, make a small change in `polls/models.py`. Find the line:
344344

345-
### Redeploy code
345+
```python
346+
choice_text = models.CharField(max_length=200)
347+
```
348+
349+
And change it to:
350+
351+
```python
352+
choice_text = models.CharField(max_length=100)
353+
```
354+
355+
By changing the data model, you need to create a new Django migration. Do it with the following command:
356+
357+
```
358+
python manage.py makemigrations
359+
```
346360

347-
To redeploy the changes, just run the following command from the repository root:
361+
You can test your changes locally by running migrations, running the development server, and navigating to *http:\//localhost:8000/admin*:
362+
363+
```
364+
python manage.py migrate
365+
python manage.py runserver
366+
```
367+
368+
### Redeploy code to Azure
369+
370+
To redeploy the changes, run the following command from the repository root:
348371

349372
```azurecli
350373
az webapp up --name <app-name>
351374
```
352375

353-
### Rerun migrations
376+
App Service detects that the app exists and just deploys the code.
377+
378+
### Rerun migrations in Azure
354379

355-
To rerun database migrations in App Service, open an SSH session in the browser by navigating to *https://\<app-name>.scm.azurewebsites.net/webssh/host*. Run the following commands:
380+
Because you made changes to the data model, you need to rerun database migrations in App Service. Open an SSH session in the browser by navigating to *https://\<app-name>.scm.azurewebsites.net/webssh/host*. Run the following commands:
356381

357382
```
358383
cd site/wwwroot

0 commit comments

Comments
 (0)