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: content/learning-paths/servers-and-cloud-computing/django-on-gcp/_index.md
+29-12Lines changed: 29 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,25 @@
1
1
---
2
-
title: Deploy Django on Google Cloud C4A (Arm-based Axion VMs)
2
+
title: Deploy Django on Arm-based Google Cloud C4A
3
3
4
-
minutes_to_complete: 30
4
+
minutes_to_complete: 60
5
5
6
-
who_is_this_for: This Learning Path is for software developers deploying and optimizing Django-based web applications on Arm64 Linux environments, specifically using Google Cloud C4A virtual machines powered by Axion processors.
6
+
who_is_this_for: This is an introductory topic for DevOps engineers and software developers who want to deploy, operate, and benchmark a production-grade Django REST API on Google Kubernetes Engine (GKE) running on Arm64 Axion processors, integrated with managed Google Cloud data services
7
7
8
8
learning_objectives:
9
-
- Provision an Arm-based SUSE Linux Enterprise Server (SLES) virtual machine on Google Cloud (C4A with Axion processors)
10
-
- Install Django on a SUSE Arm64 (C4A) instance
11
-
- Verify Django functionality by running the development server and accessing the default welcome page on the Arm64 VM
12
-
- Measure Django application performance by benchmarking request handling throughput and latency using the official ApacheBench (ab) tool with Gunicorn on Arm64 (aarch64)
9
+
- Provision Arm-based Axion compute on Google Cloud using virtual machines and GKE node pools
10
+
- Package a Django REST API into an Arm-native Docker container
11
+
- Push container images to Google Artifact Registry
12
+
- Deploy Django on GKE using Kubernetes manifests (Deployment, Service, ConfigMap, Secrets)
13
+
- Integrate Django with Cloud SQL (PostgreSQL) over private IP
14
+
- Integrate Django with Memorystore (Redis) for caching and sessions
15
+
- Expose Django using a Kubernetes LoadBalancer
16
+
- Validate application connectivity to PostgreSQL and Redis
17
+
- Measure throughput and p95 latency using ApacheBench against Gunicorn on Arm
13
18
14
19
prerequisites:
15
20
- A [Google Cloud Platform (GCP)](https://cloud.google.com/free) account with billing enabled
16
21
- Basic familiarity with [Django](https://www.djangoproject.com/)
22
+
- Basic understanding of containers and Kubernetes concepts
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/django-on-gcp/background.md
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Get started with Django on Google Axion C4A (Arm Neoverse-V2)
2
+
title: Get started with Django on Google Axion C4A
3
3
4
4
weight: 2
5
5
@@ -12,10 +12,10 @@ Google Axion C4A is a family of Arm-based virtual machines built on Google’s c
12
12
13
13
The C4A series provides a cost-effective alternative to x86 virtual machines while leveraging the scalability and performance benefits of the Arm architecture in Google Cloud.
14
14
15
-
To learn more about Google Axion, see the [Introducing Google Axion Processors, our new Arm-based CPUs](https://cloud.google.com/blog/products/compute/introducing-googles-new-arm-based-cpu) blog.
15
+
To learn more, see the Google blog [Introducing Google Axion Processors, our new Arm-based CPUs](https://cloud.google.com/blog/products/compute/introducing-googles-new-arm-based-cpu).
16
16
17
17
18
-
## Understand Django on Google Axion C4A (Arm Neoverse-V2)
18
+
## Explore Django on Google Axion C4A (Arm NeoverseV2)
19
19
20
20
Django is a high-level, open-source Python web framework that encourages rapid development and clean, pragmatic design. Developed and maintained by the [Django Software Foundation](https://www.djangoproject.com/foundation/), it simplifies web application development by handling much of the boilerplate and providing powerful built-in features.
21
21
@@ -27,10 +27,13 @@ Common use cases include web applications, content management systems, APIs, e-c
27
27
28
28
To learn more, visit the [Django website](https://www.djangoproject.com/) and explore the [Django documentation](https://docs.djangoproject.com/en/stable/).
29
29
30
-
## Summary and what's next
30
+
## What you've accomplished and what's next
31
31
32
-
You now understand the capabilities of Google Axion C4A Arm-based VMs and why Django is an excellent choice for building web applications on Arm infrastructure. The combination provides a cost-effective, high-performance platform for deploying Python web applications at scale.
32
+
In this section, you learned about:
33
+
- Google Axion C4A Arm-based VMs and their performance characteristics
34
+
- Django web framework and its suitability for building REST APIs
35
+
- How Arm architecture provides cost-effective, high-performance infrastructure for Python applications
33
36
34
-
In the next sections, you'll provision your own Arm-based VM on Google Cloud, install Django, and benchmark your application's performance. You're ready to start building!
37
+
Next, you'll configure firewall rules to allow external access to your Djangoapplication.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/django-on-gcp/baseline.md
+29-36Lines changed: 29 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,24 +6,13 @@ weight: 6
6
6
layout: learningpathall
7
7
---
8
8
9
-
## Verify Django is working on your Arm-based VM
9
+
## Verify Django installation
10
10
11
-
In this section, you'll confirm that Django is installed correctly and can serve web requests on your Google Cloud C4A VM. You'll create a Django project, run the development server, and access it from your browser. This hands-on verification ensures your environment is ready for development and testing.
12
-
13
-
By the end of this section, you'll have:
14
-
- Created a Django project with proper directory structure
15
-
- Configured Django to accept requests from your VM's external IP
16
-
- Run the development server and accessed it from your browser
17
-
- Built a simple Django app with custom routing and views
18
-
- Verified that Django can handle HTTP requests and render responses
19
-
20
-
Let's get started!
21
-
22
-
## Create and test a basic Django project
11
+
In this section, you'll confirm that Django is installed correctly and can serve web requests on your Google Cloud C4A VM. You'll create a Django project, run the development server, and access it from your browser.
23
12
24
13
Run the following command to create a new Django project named `myproject`:
25
14
26
-
```console
15
+
```bash
27
16
django-admin startproject myproject
28
17
cd myproject
29
18
```
@@ -46,7 +35,7 @@ The `manage.py` file is Django's command-line utility for project management. Th
46
35
47
36
Set up your project's database by running migrations, which create the required tables for Django's built-in apps:
48
37
49
-
```console
38
+
```bash
50
39
python3 manage.py migrate
51
40
```
52
41
@@ -58,30 +47,29 @@ Before starting the Django development server, you must configure your `ALLOWED_
58
47
59
48
Navigate to your project settings directory:
60
49
61
-
```console
50
+
```bash
62
51
cd~/myproject/myproject/
63
52
```
64
53
65
54
Open `settings.py` using a text editor:
66
55
67
-
```console
68
-
edit myproject/settings.py
69
-
```
70
-
71
-
- Locate the `ALLOWED_HOSTS` Line
72
-
Inside the file, find the following line:
56
+
```bash
57
+
edit myproject/settings.py
58
+
```
59
+
60
+
Locate the `ALLOWED_HOSTS` line inside the file:
73
61
74
62
```python
75
63
ALLOWED_HOSTS= []
76
64
```
77
65
78
66
Update it to allow your VM's external IP address:
79
67
80
-
- Allow All Hosts (for Testing Only)
81
-
To make your Django app accessible from your VM’s external IP address, update it to:
82
-
```python
83
-
ALLOWED_HOSTS= ['*']
84
-
```
68
+
To make your Django app accessible from your VM's external IP address, update it to:
69
+
70
+
```python
71
+
ALLOWED_HOSTS= ['*']
72
+
```
85
73
{{% notice Note %}}
86
74
For development and testing only, you can use `ALLOWED_HOSTS = ['*']` to allow all hosts. However, for production deployments, always specify explicit domain names or IP addresses such as `ALLOWED_HOSTS = ['your-external-ip', 'your-domain.com']`.
Now that you've configured `ALLOWED_HOSTS`, start the development server:
94
82
95
-
```console
83
+
```bash
96
84
python3 manage.py runserver 0.0.0.0:8000
97
85
```
98
86
@@ -110,7 +98,7 @@ Replace `<YOUR_VM_EXTERNAL_IP>` with the public IP address of your GCP VM.
110
98
111
99
You should see the Django welcome page with the message "The install worked successfully!":
112
100
113
-

101
+

114
102
115
103
## Build a simple Django app with custom routing
116
104
@@ -124,7 +112,7 @@ Press **Ctrl + C** in your terminal to stop the Django development server.
124
112
125
113
Within your Django project directory, create a new app named `hello`:
126
114
127
-
```console
115
+
```bash
128
116
python3 manage.py startapp hello
129
117
```
130
118
@@ -148,7 +136,7 @@ Edit `hello/views.py` and replace the entire file with:
148
136
from django.http import HttpResponse
149
137
150
138
defhome(request):
151
-
return HttpResponse("<h1>Hello, Django on Arm!</h1>")
139
+
return HttpResponse("<h1>Hello, Django on GCP SUSE ARM64!</h1>")
152
140
```
153
141
154
142
This simple view function returns a basic HTML message as an HTTP response.
@@ -220,7 +208,7 @@ INSTALLED_APPS = [
220
208
221
209
Restart the Django development server:
222
210
223
-
```console
211
+
```bash
224
212
python3 manage.py runserver 0.0.0.0:8000
225
213
```
226
214
@@ -232,10 +220,15 @@ Open your browser and navigate to:
232
220
http://<YOUR_VM_EXTERNAL_IP>:8000
233
221
```
234
222
235
-
You should now see your custom message displayed:
223
+
Your browser displays your custom message:
224
+
225
+

236
226
237
-

227
+
## What you've accomplished and what's next
238
228
239
-
## Summary and what's next
229
+
In this section, you:
230
+
- Created a Django project and ran the development server
231
+
- Built a custom Django app with routing and views
232
+
- Verified that Django serves web requests successfully on your Arm VM
240
233
241
-
You've successfully verified that Django is installed and working on your Arm-based VM. Your application can serve web requests, handle routing, and render custom views. Great job, you're ready to benchmark your Django application!
234
+
Next, you'll set up the complete GKE infrastructure with Cloud SQL and Memorystore for production deployment.
0 commit comments