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/postgresql/flexible-server/tutorial-django-aks-database.md
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,9 +20,11 @@ In this quickstart, you deploy a Django application on Azure Kubernetes Service
20
20
**[AKS](../../aks/intro-kubernetes.md)** is a managed Kubernetes service that lets you quickly deploy and manage clusters. **[Azure Database for PostgreSQL - Flexible Server ](overview.md)** is a fully managed database service designed to provide more granular control and flexibility over database management functions and configuration settings.
21
21
22
22
> [!NOTE]
23
-
> -This quickstart assumes a basic understanding of Kubernetes concepts, Django and PostgreSQL.
23
+
> This quickstart assumes a basic understanding of Kubernetes concepts, Django and PostgreSQL.
- Launch [Azure Cloud Shell](https://shell.azure.com) in new browser window. You can [install Azure CLI](/cli/azure/install-azure-cli#install) on your local machine too. If you're using a local install, login with Azure CLI by using the [az login](/cli/azure/reference-index#az-login) command. To finish the authentication process, follow the steps displayed in your terminal.
@@ -154,6 +156,7 @@ DATABASES={
154
156
```
155
157
156
158
### Generate a requirements.txt file
159
+
157
160
Create a ```requirements.txt``` file to list out the dependencies for the Django Application. Here is an example ```requirements.txt``` file. You can use [``` pip freeze > requirements.txt```](https://pip.pypa.io/en/stable/reference/pip_freeze/) to generate a requirements.txt file for your existing application.
158
161
159
162
```text
@@ -165,6 +168,7 @@ pytz==2020.4
165
168
```
166
169
167
170
### Create a Dockerfile
171
+
168
172
Create a new file named ```Dockerfile``` and copy the code snippet below. This Dockerfile in setting up Python 3.8 and installing all the requirements listed in requirements.txt file.
169
173
170
174
```docker
@@ -190,11 +194,11 @@ RUN pip install -r requirements.txt
190
194
191
195
# Run the application:
192
196
193
-
194
197
CMD python manage.py runserver 0.0.0.0:8000
195
198
```
196
199
197
200
### Build your image
201
+
198
202
Make sure you're in the directory ```my-django-app``` in a terminal using the ```cd``` command. Run the following command to build your bulletin board image:
Deploy your image to [Docker hub](https://docs.docker.com/get-started/part3/#create-a-docker-hub-repository-and-push-your-image) or [Azure Container registry](../../container-registry/container-registry-get-started-azure-cli.md).
205
209
206
210
> [!IMPORTANT]
207
-
>If you are using Azure container registry (ACR), then run the ```az aks update``` command to attach ACR account with the AKS cluster.
211
+
>If you are using Azure container registry (ACR), then run the ```az aks update``` command to attach ACR account with the AKS cluster.
208
212
>
209
-
>```azurecli-interactive
210
-
>az aks update -n djangoappcluster -g django-project --attach-acr <your-acr-name>
213
+
>```azurecli-interactive
214
+
>az aks update -n djangoappcluster -g django-project --attach-acr <your-acr-name>
211
215
> ```
212
216
213
217
## Create Kubernetes manifest file
214
218
215
219
A Kubernetes manifest file defines a desired state for the cluster, such as what container images to run. Let's create a manifest file named ```djangoapp.yaml``` and copy in the following YAML definition.
216
220
217
-
>[!IMPORTANT]
218
-
> - Update ```env``` section below with your ```SERVERNAME```, ```YOUR-DATABASE-USERNAME```, ```YOUR-DATABASE-PASSWORD``` of your postgres flexible server.
221
+
>[!IMPORTANT]
222
+
> Update ```env``` section below with your ```SERVERNAME```, ```YOUR-DATABASE-USERNAME```, ```YOUR-DATABASE-PASSWORD``` of your postgres flexible server.
219
223
220
224
```yaml
221
225
apiVersion: apps/v1
@@ -272,6 +276,7 @@ spec:
272
276
```
273
277
274
278
## Deploy Django to AKS cluster
279
+
275
280
Deploy the application using the [kubectl apply](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#apply) command and specify the name of your YAML manifest:
Now open a web browser to the external IP address of your service (http://\<service-external-ip-address\>) and view the Django application.
314
319
315
-
>[!NOTE]
320
+
>[!NOTE]
316
321
> - Currently the Django site is not using HTTPS. It is recommended to [ENABLE TLS with your own certificates](../../aks/ingress-own-tls.md).
317
-
> - You can enable [HTTP routing](../../aks/http-application-routing.md) for your cluster. When http routing is enabled, it configures an Ingress controller in your AKS cluster. As applications are deployed, the solution also creates publicly accessible DNS names for application endpoints.
322
+
> - You can enable [HTTP routing](../../aks/http-application-routing.md) for your cluster. When http routing is enabled, it configures an Ingress controller in your AKS cluster. As > > applications are deployed, the solution also creates publicly accessible DNS names for application endpoints.
0 commit comments