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
# Deploy a Python Django web app with PostgreSQL in Azure
14
14
15
-
In this tutorial, you'll deploy a data-driven Python web app (**[Django](https://www.djangoproject.com/)**) to **[Azure App Service](./overview.md#app-service-on-linux)** with the **[Azure Database for PostgreSQL](/azure/postgresql/)** relational database service. Azure App Service supports [Python](https://www.python.org/downloads/) in a Linux server environment.
15
+
In this tutorial, you'll deploy a data-driven Python web app (**[Django](https://www.djangoproject.com/)**) to **[Azure App Service](./overview.md#app-service-on-linux)** with the **[Azure Database for PostgreSQL](/azure/postgresql/)** relational database service. Azure App Service supports [Python](https://www.python.org/downloads/) in a Linux server environment. If you want, see the [Flask tutorial](tutorial-python-postgresql-app-flask.md) or the [FastAPI tutorial](tutorial-python-postgresql-app-fastapi.md) instead.
16
16
17
17
:::image type="content" border="False" source="./media/tutorial-python-postgresql-app-django/python-postgresql-app-architecture-240px.png" lightbox="./media/tutorial-python-postgresql-app-django/python-postgresql-app-architecture.png" alt-text="An architecture diagram showing an App Service with a PostgreSQL database in Azure.":::
18
18
@@ -223,7 +223,7 @@ The creation wizard generated the connectivity variables for you already as [app
223
223
1. In the top search bar, type *msdocs-python-postgres*, then select the App Service resource called **msdocs-python-postgres-XYZ**.
224
224
1. In the App Service page, in the left menu, select **Settings > Service Connector**. There's already a connector, which the app creation wizard created for you.
225
225
1. Select checkbox next to the PostgreSQL connector, then select **Edit**.
226
-
1. In **Client type**, select **Django**. The [Django client type in the PostgreSQL service connector](/azure/service-connector/how-to-integrate-postgres?tabs=django#connection-string) gives you database variables in separate settings instead of one connection string. The separate variables are easier for you to use in your SQLAlchemy code.
226
+
1. In **Client type**, select **Django**. The [Django client type in the PostgreSQL service connector](/azure/service-connector/how-to-integrate-postgres?tabs=django#connection-string) gives you database variables in separate settings instead of one connection string. The separate variables are easier for you to use in Django's [database settings](https://docs.djangoproject.com/en/5.1/ref/settings/#databases).
227
227
1. Select the **Authentication** tab.
228
228
1. In **Password**, paste the password you copied earlier.
229
229
1. Select **Store Secret in Key Vault**.
@@ -351,8 +351,8 @@ In this step, you'll configure GitHub deployment using GitHub Actions. It's just
351
351
:::column span="2":::
352
352
**Step 4 (Option 1: with GitHub Copilot):**
353
353
1. Start a new chat session by selecting the **Chat** view, then selecting **+**.
354
-
1. Ask, "*@workspace How does the app connect to the database and redis?*" Copilot might give you some explanation about `SQLAlchemy`how it's connection URI is configured in *azureproject/development.py* and *azureproject/production.py*.
355
-
1. Ask, "@workspace In production mode, my app is running in an App Service web app, which uses Azure Service Connector to connect to a PostgreSQL flexible server using the Django client type. What are the environment variable names I need to use?*" Copilot might give you a code suggestion similar to the one in the **Option 2: without GitHub Copilot** steps below and even tell you to make the change in the *azureproject/production.py* file.
354
+
1. Ask, "*@workspace How does the app connect to the database and redis?*" Copilot might give you some explanation about how the settings are configured in *azureproject/development.py* and *azureproject/production.py*.
355
+
1. Ask, "*@workspace In production mode, my app is running in an App Service web app, which uses Azure Service Connector to connect to a PostgreSQL flexible server using the Django client type. What are the environment variable names I need to use?*" Copilot might give you a code suggestion similar to the one in the **Option 2: without GitHub Copilot** steps below and even tell you to make the change in the *azureproject/production.py* file.
356
356
1. Open *azureproject/production.py* in the explorer and add the code suggestion.
357
357
1. Ask, "@workspace My App Service app also uses Azure Service Connector to connect to a Cache for Redis using the Django client type. What are the environment variable names I need to use?*" Copilot might give you a code suggestion similar to the one in the **Option 2: without GitHub Copilot** steps below and even tell you to make the change in the *azureproject/production.py* file.
358
358
1. Add the code suggestion.
@@ -600,9 +600,9 @@ Having issues? Check the [Troubleshooting section](#troubleshooting).
600
600
601
601
1. In the GitHub codespace, start a new chat session by selecting the **Chat** view, then selecting **+**.
602
602
603
-
1. Ask, "*@workspace How does the app connect to the database?*" Copilot might give you some explanation about `SQLAlchemy`how it's connection URI is configured in *azureproject/development.py* and *azureproject/production.py*.
603
+
1. Ask, "*@workspace How does the app connect to the database?*" Copilot might give you some explanation about how the connection settings are configured in*azureproject/development.py* and *azureproject/production.py*.
604
604
605
-
1. Ask, "@workspace In production mode, my app is running in an App Service web app, which uses Azure Service Connector to connect to a PostgreSQL flexible server using the Django client type. What are the environment variable names I need to use?*" Copilot might give you a code suggestion similar to the one in the **Option 2: without GitHub Copilot** steps below and even tell you to make the change in the *azureproject/production.py* file.
605
+
1. Ask, "*@workspace In production mode, my app is running in an App Service web app, which uses Azure Service Connector to connect to a PostgreSQL flexible server using the Django client type. What are the environment variable names I need to use?*" Copilot might give you a code suggestion similar to the one in the **Option 2: without GitHub Copilot** steps below and even tell you to make the change in the *azureproject/production.py* file.
606
606
607
607
1. Open *azureproject/production.py*in the explorer and add the code suggestion.
# Deploy a Python FastAPI web app with PostgreSQL in Azure
14
14
15
-
In this tutorial, you deploy a data-driven Python web app (**[FastAPI](https://fastapi.tiangolo.com/)** ) to **[Azure App Service](./overview.md#app-service-on-linux)** with the **[Azure Database for PostgreSQL](/azure/postgresql/)** relational database service. Azure App Service supports [Python](https://www.python.org/downloads/) in a Linux server environment.
15
+
In this tutorial, you deploy a data-driven Python web app (**[FastAPI](https://fastapi.tiangolo.com/)** ) to **[Azure App Service](./overview.md#app-service-on-linux)** with the **[Azure Database for PostgreSQL](/azure/postgresql/)** relational database service. Azure App Service supports [Python](https://www.python.org/downloads/) in a Linux server environment. If you want, see the [Flask tutorial](tutorial-python-postgresql-app-flask.md) or the [Django tutorial](tutorial-python-postgresql-app-django.md) instead.
16
16
17
17
:::image type="content" border="False" source="./media/tutorial-python-postgresql-app-fastapi/python-postgresql-app-architecture-240px.png" lightbox="./media/tutorial-python-postgresql-app-fastapi/python-postgresql-app-architecture.png" alt-text="An architecture diagram showing an App Service with a PostgreSQL database in Azure.":::
# Deploy a Python (Flask) web app with PostgreSQL in Azure
15
15
16
-
In this tutorial, you'll deploy a data-driven Python web app (**[Flask](https://flask.palletsprojects.com/)**) to **[Azure App Service](./overview.md#app-service-on-linux)** with the **[Azure Database for PostgreSQL](/azure/postgresql/)** relational database service. Azure App Service supports [Python](https://www.python.org/downloads/) in a Linux server environment.
16
+
In this tutorial, you'll deploy a data-driven Python web app (**[Flask](https://flask.palletsprojects.com/)**) to **[Azure App Service](./overview.md#app-service-on-linux)** with the **[Azure Database for PostgreSQL](/azure/postgresql/)** relational database service. Azure App Service supports [Python](https://www.python.org/downloads/) in a Linux server environment. If you want, see the [Django tutorial](tutorial-python-postgresql-app-django.md) or the [FastAPI tutorial](tutorial-python-postgresql-app-fastapi.md) instead.
17
17
18
18
:::image type="content" border="False" source="./media/tutorial-python-postgresql-app-flask/python-postgresql-app-architecture-240px.png" lightbox="./media/tutorial-python-postgresql-app-flask/python-postgresql-app-architecture.png" alt-text="An architecture diagram showing an App Service with a PostgreSQL database in Azure.":::
19
19
@@ -225,7 +225,7 @@ The creation wizard generated the connectivity variables for you already as [app
225
225
1. In the top search bar, type *msdocs-python-postgres*, then select the App Service resource called **msdocs-python-postgres-XYZ**.
226
226
1. In the App Service page, in the left menu, select **Settings > Service Connector**. There's already a connector, which the app creation wizard created for you.
227
227
1. Select checkbox next to the PostgreSQL connector, then select **Edit**.
228
-
1. In **Client type**, select **Django**. Even though you have a Flask app, the [Django client type in the PostgreSQL service connector](/azure/service-connector/how-to-integrate-postgres?tabs=django#connection-string) gives you database variables in separate settings instead of one connection string. The separate variables are easier for you to use in your SQLAlchemy code.
228
+
1. In **Client type**, select **Django**. Even though you have a Flask app, the [Django client type in the PostgreSQL service connector](/azure/service-connector/how-to-integrate-postgres?tabs=django#connection-string) gives you database variables in separate settings instead of one connection string. The separate variables are easier for you to use in your application code, which uses [SQLAlchemy](https://pypi.org/project/SQLAlchemy/) to connect to the database.
229
229
1. Select the **Authentication** tab.
230
230
1. In **Password**, paste the password you copied earlier.
231
231
1. Select **Store Secret in Key Vault**.
@@ -323,7 +323,7 @@ In this step, you'll configure GitHub deployment using GitHub Actions. It's just
323
323
**Step 4 (Option 1: with GitHub Copilot):**
324
324
1. Start a new chat session by selecting the **Chat** view, then selecting **+**.
325
325
1. Ask, "*@workspace How does the app connect to the database?*" Copilot might give you some explanation about `SQLAlchemy` how it's connection URI is configured in *azureproject/development.py* and *azureproject/production.py*.
326
-
1. Ask, "@workspace In production mode, my app is running in an App Service web app, which uses Azure Service Connector to connect to a PostgreSQL flexible server using the Django client type. What are the environment variable names I need to use?*" Copilot might give you a code suggestion similar to the one in the **Option 2: without GitHub Copilot** steps below and even tell you to make the change in the *azureproject/production.py* file.
326
+
1. Ask, "*@workspace In production mode, my app is running in an App Service web app, which uses Azure Service Connector to connect to a PostgreSQL flexible server using the Django client type. What are the environment variable names I need to use?*" Copilot might give you a code suggestion similar to the one in the **Option 2: without GitHub Copilot** steps below and even tell you to make the change in the *azureproject/production.py* file.
327
327
1. Open *azureproject/production.py* in the explorer and add the code suggestion.
328
328
GitHub Copilot doesn't give you the same response every time, and it's not always correct. You might need to ask more questions to fine-tune its response. For tips, see [What can I do with GitHub Copilot in my codespace?](#what-can-i-do-with-github-copilot-in-my-codespace).
329
329
:::column-end:::
@@ -571,7 +571,7 @@ Having issues? Check the [Troubleshooting section](#troubleshooting).
571
571
572
572
1. Ask, "*@workspace How does the app connect to the database?*" Copilot might give you some explanation about `SQLAlchemy` how it's connection URI is configured in *azureproject/development.py* and *azureproject/production.py*.
573
573
574
-
1. Ask, "@workspace In production mode, my app is running in an App Service web app, which uses Azure Service Connector to connect to a PostgreSQL flexible server using the Django client type. What are the environment variable names I need to use?*" Copilot might give you a code suggestion similar to the one in the **Option 2: without GitHub Copilot** steps below and even tell you to make the change in the *azureproject/production.py* file.
574
+
1. Ask, "*@workspace In production mode, my app is running in an App Service web app, which uses Azure Service Connector to connect to a PostgreSQL flexible server using the Django client type. What are the environment variable names I need to use?*" Copilot might give you a code suggestion similar to the one in the **Option 2: without GitHub Copilot** steps below and even tell you to make the change in the *azureproject/production.py* file.
575
575
576
576
1. Open *azureproject/production.py* in the explorer and add the code suggestion.
0 commit comments