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-fastapi.md
+11-12Lines changed: 11 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ In this tutorial, you'll deploy a data-driven Python web app (**[FastAPI](https:
21
21
::: zone pivot="azure-portal"
22
22
23
23
* 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).
24
-
* Knowledge of Python with Flask development or [Python with Django development](/training/paths/django-create-data-driven-websites/)
24
+
* Knowledge of Python with FastAPI development
25
25
26
26
::: zone-end
27
27
@@ -45,7 +45,7 @@ azd up
45
45
46
46
## Sample application
47
47
48
-
Sample Python application using FastAPI framework is provided to help you follow along with this tutorial. To deploy it without running it locally, skip this part.
48
+
A sample Python application using FastAPI framework is provided to help you follow along with this tutorial. To deploy it without running it locally, skip this part.
49
49
50
50
To run the application locally, make sure you have [Python 3.8 or higher](https://www.python.org/downloads/) and [PostgreSQL](https://www.postgresql.org/download/) installed locally. Then, clone the sample repository's `starter-no-infra` branch and change to the repository root.
51
51
@@ -110,7 +110,7 @@ Sign in to the [Azure portal](https://portal.azure.com/) and follow these steps
110
110
You can also navigate to the [creation wizard](https://portal.azure.com/?feature.customportal=false#create/Microsoft.AppServiceWebAppDatabaseV3) directly.
111
111
:::column-end:::
112
112
:::column:::
113
-
:::image type="content" source="./media/tutorial-python-postgresql-app-fastapi/azure-portal-create-app-postgres-1.png" alt-text="A screenshot showing how to use the search box in the top tool bar to find the Web App + Database creation wizard (Flask)." lightbox="./media/tutorial-python-postgresql-app-fastapi/azure-portal-create-app-postgres-1.png":::
113
+
:::image type="content" source="./media/tutorial-python-postgresql-app-fastapi/azure-portal-create-app-postgres-1.png" alt-text="A screenshot showing how to use the search box in the top tool bar to find the Web App + Database creation wizard (FastAPI)." lightbox="./media/tutorial-python-postgresql-app-fastapi/azure-portal-create-app-postgres-1.png":::
114
114
:::column-end:::
115
115
:::row-end:::
116
116
:::row:::
@@ -126,7 +126,7 @@ Sign in to the [Azure portal](https://portal.azure.com/) and follow these steps
126
126
1. After validation completes, select **Create**.
127
127
:::column-end:::
128
128
:::column:::
129
-
:::image type="content" source="./media/tutorial-python-postgresql-app-fastapi/azure-portal-create-app-postgres-2.png" alt-text="A screenshot showing how to configure a new app and database in the Web App + Database wizard (Flask)." lightbox="./media/tutorial-python-postgresql-app-fastapi/azure-portal-create-app-postgres-2.png":::
129
+
:::image type="content" source="./media/tutorial-python-postgresql-app-fastapi/azure-portal-create-app-postgres-2.png" alt-text="A screenshot showing how to configure a new app and database in the Web App + Database wizard (FastAPI)." lightbox="./media/tutorial-python-postgresql-app-fastapi/azure-portal-create-app-postgres-2.png":::
130
130
:::column-end:::
131
131
:::row-end:::
132
132
:::row:::
@@ -140,7 +140,7 @@ Sign in to the [Azure portal](https://portal.azure.com/) and follow these steps
140
140
- **Private DNS zone**→ Enables DNS resolution of the PostgreSQL server in the virtual network.
141
141
:::column-end:::
142
142
:::column:::
143
-
:::image type="content" source="./media/tutorial-python-postgresql-app-fastapi/azure-portal-create-app-postgres-3.png" alt-text="A screenshot showing the deployment process completed (Flask)." lightbox="./media/tutorial-python-postgresql-app-fastapi/azure-portal-create-app-postgres-3.png":::
143
+
:::image type="content" source="./media/tutorial-python-postgresql-app-fastapi/azure-portal-create-app-postgres-3.png" alt-text="A screenshot showing the deployment process completed (FastAPI)." lightbox="./media/tutorial-python-postgresql-app-fastapi/azure-portal-create-app-postgres-3.png":::
144
144
:::column-end:::
145
145
:::row-end:::
146
146
:::row:::
@@ -297,7 +297,7 @@ With the PostgreSQL database protected by the virtual network, the easiest way t
297
297
Congratulations, you're running a web app in Azure App Service, with secure connectivity to Azure Database for PostgreSQL.
298
298
:::column-end:::
299
299
:::column:::
300
-
:::image type="content" source="./media/tutorial-python-postgresql-app-fastapi/azure-portal-browse-app-2.png" alt-text="A screenshot of the Flask web app with PostgreSQL running in Azure showing restaurants and restaurant reviews (Flask)." lightbox="./media/tutorial-python-postgresql-app-fastapi/azure-portal-browse-app-2.png":::
300
+
:::image type="content" source="./media/tutorial-python-postgresql-app-fastapi/azure-portal-browse-app-2.png" alt-text="A screenshot of the FastAPI web app with PostgreSQL running in Azure showing restaurants and restaurant reviews (FastAPI)." lightbox="./media/tutorial-python-postgresql-app-fastapi/azure-portal-browse-app-2.png":::
301
301
:::column-end:::
302
302
:::row-end:::
303
303
@@ -376,7 +376,7 @@ In this step, you create the Azure resources and deploy a sample app to App Serv
376
376
cd msdocs-fastapi-postgresql-sample-app
377
377
```
378
378
379
-
This cloned branch is your starting point. It contains a simple data-drive Flask application.
379
+
This cloned branch is your starting point. It contains a simple data-drive FastAPI application.
380
380
381
381
1. From the repository root, run `azd init`.
382
382
@@ -457,9 +457,9 @@ With the PostgreSQL database protected by the virtual network, the easiest way t
457
457
Open SSH session to App Service container at: https://<app-name>.scm.azurewebsites.net/webssh/host
458
458
</pre>
459
459
460
-
1. In the SSH terminal, run `flask db upgrade`. If it succeeds, App Service is [connecting successfully to the database](#i-get-an-error-when-running-database-migrations).
460
+
1. In the SSH terminal, run `python3 src/fastapi_app/seed_data.py`. If it succeeds, App Service is [connecting successfully to the database](#i-get-an-error-when-running-database-migrations).
461
461
462
-
:::image type="content" source="./media/tutorial-python-postgresql-app-fastapi/azure-portal-generate-db-schema-flask-2.png" alt-text="A screenshot showing the commands to run in the SSH shell and their output (Flask)." lightbox="./media/tutorial-python-postgresql-app-fastapi/azure-portal-generate-db-schema-flask-2.png":::
462
+
:::image type="content" source="./media/tutorial-python-postgresql-app-fastapi/azure-portal-generate-db-schema-flask-2.png" alt-text="A screenshot showing the commands to run in the SSH shell and their output (FastAPI)." lightbox="./media/tutorial-python-postgresql-app-fastapi/azure-portal-generate-db-schema-flask-2.png":::
463
463
464
464
> [!NOTE]
465
465
> Only changes to files in`/home` can persist beyond app restarts. Changes outside of `/home` aren't persisted.
@@ -478,7 +478,7 @@ With the PostgreSQL database protected by the virtual network, the easiest way t
478
478
479
479
2. Add a few restaurants to the list.
480
480
481
-
:::image type="content" source="./media/tutorial-python-postgresql-app-fastapi/azure-portal-browse-app-2.png" alt-text="A screenshot of the Flask web app with PostgreSQL running in Azure showing restaurants and restaurant reviews (Flask)." lightbox="./media/tutorial-python-postgresql-app-fastapi/azure-portal-browse-app-2.png":::
481
+
:::image type="content" source="./media/tutorial-python-postgresql-app-fastapi/azure-portal-browse-app-2.png" alt-text="A screenshot of the FastAPI web app with PostgreSQL running in Azure showing restaurants and restaurant reviews (FastAPI)." lightbox="./media/tutorial-python-postgresql-app-fastapi/azure-portal-browse-app-2.png":::
482
482
483
483
Congratulations, you're running a web app in Azure App Service, with secure connectivity to Azure Database for PostgreSQL.
484
484
@@ -488,7 +488,7 @@ Azure App Service can capture console logs to help you diagnose issues with your
488
488
489
489
The sample app includes `print()` statements to demonstrate this capability as shown in the following snippet.
In the azd output, find the link to stream App Service logs and navigate to it in the browser. The link looks like this in the azd output:
494
494
@@ -524,7 +524,6 @@ If you encounter any errors related to connecting to the database, check if the
524
524
- [How much does this setup cost?](#how-much-does-this-setup-cost)
525
525
- [How do I connect to the PostgreSQL server that's secured behind the virtual network with other tools?](#how-do-i-connect-to-the-postgresql-server-thats-secured-behind-the-virtual-network-with-other-tools)
526
526
- [How does local app development work with GitHub Actions?](#how-does-local-app-development-work-with-github-actions)
527
-
- [How is the Django sample configured to run on Azure App Service?](#how-is-the-django-sample-configured-to-run-on-azure-app-service)
0 commit comments