Skip to content

Commit 1f2783f

Browse files
Merge pull request #2 from DougAnsonAustinTX/django-techreview-2
Django techreview 2
2 parents 1e8f333 + 22c1a75 commit 1f2783f

11 files changed

Lines changed: 844 additions & 170 deletions

File tree

content/learning-paths/servers-and-cloud-computing/django-on-gcp/_index.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@ title: Deploy Django on Google Cloud C4A (Arm-based Axion VMs)
33

44
minutes_to_complete: 30
55

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 Learning Path is designed 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.
77

88
learning_objectives:
99
- 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)
10+
- Provision Google Axion (Arm64) compute using GKE node pools
11+
- Package a Django REST API into an Arm-native Docker container
12+
- Push container images to Google Artifact Registry
13+
- Deploy Django on GKE using Kubernetes manifests (Deployment, Service, ConfigMap, Secrets)
14+
- Integrate Django with Cloud SQL (PostgreSQL) over private IP
15+
- Integrate Django with Memorystore (Redis) for caching and sessions
16+
- Expose Django using a Kubernetes LoadBalancer
17+
- Validate application connectivity to PostgreSQL and Redis
18+
- Measure throughput and p95 latency using ApacheBench against Gunicorn on Arm
1319

1420
prerequisites:
1521
- A [Google Cloud Platform (GCP)](https://cloud.google.com/free) account with billing enabled
@@ -27,9 +33,11 @@ armips:
2733

2834
tools_software_languages:
2935
- Django
30-
- Python
31-
- Gunicorn
32-
- Apache Bench
36+
- Docker
37+
- Kubernetes
38+
- Google Artifact Registry
39+
- Cloud SQL (PostgreSQL)
40+
- Memorystore (Redis)
3341

3442
operatingsystems:
3543
- Linux
@@ -47,9 +55,18 @@ further_reading:
4755
title: Django documentation
4856
link: https://docs.djangoproject.com/
4957
type: documentation
58+
- resource:
59+
title: Cloud SQL for PostgreSQL
60+
link: https://cloud.google.com/sql/docs/postgres
61+
type: documentation
62+
63+
- resource:
64+
title: Memorystore for Redis
65+
link: https://cloud.google.com/memorystore/docs/redis
66+
type: documentation
5067

5168
- resource:
52-
title: Apache-bench documentation
69+
title: Apache Bench documentation
5370
link: https://httpd.apache.org/docs/2.4/programs/ab.html
5471
type: documentation
5572

content/learning-paths/servers-and-cloud-computing/django-on-gcp/background.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ To learn more, visit the [Django website](https://www.djangoproject.com/) and ex
3131

3232
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.
3333

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!
34+
In the next sections, you'll provision your own Arm-based VM on Google Cloud, install Django, and benchmark your application's performance.
3535

3636

content/learning-paths/servers-and-cloud-computing/django-on-gcp/baseline.md

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,11 @@ layout: learningpathall
88

99
## Verify Django is working on your Arm-based VM
1010

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.
2312

2413
Run the following command to create a new Django project named `myproject`:
2514

26-
```console
15+
```bash
2716
django-admin startproject myproject
2817
cd myproject
2918
```
@@ -46,7 +35,7 @@ The `manage.py` file is Django's command-line utility for project management. Th
4635

4736
Set up your project's database by running migrations, which create the required tables for Django's built-in apps:
4837

49-
```console
38+
```bash
5039
python3 manage.py migrate
5140
```
5241

@@ -58,27 +47,29 @@ Before starting the Django development server, you must configure your `ALLOWED_
5847

5948
Navigate to your project settings directory:
6049

61-
```console
50+
```bash
6251
cd ~/myproject/myproject/
6352
```
6453

6554
Open `settings.py` using a text editor:
6655

67-
```console
56+
```bash
6857
edit myproject/settings.py
6958
```
7059

71-
- Locate the `ALLOWED_HOSTS` Line
72-
Inside the file, find the following line:
60+
- Locate the ALLOWED_HOSTS line
61+
62+
Inside the file, find the following line:
7363

7464
```python
7565
ALLOWED_HOSTS = []
7666
```
7767

7868
Update it to allow your VM's external IP address:
7969

80-
- Allow All Hosts (for Testing Only)
81-
To make your Django app accessible from your VM’s external IP address, update it to:
70+
- Allow all hosts (for testing only)
71+
72+
To make your Django app accessible from your VM's external IP address, update it to:
8273
```python
8374
ALLOWED_HOSTS = ['*']
8475
```
@@ -92,7 +83,7 @@ ALLOWED_HOSTS = ['your-external-ip', 'your-domain.com']
9283

9384
Now that you've configured `ALLOWED_HOSTS`, start the development server:
9485

95-
```console
86+
```bash
9687
python3 manage.py runserver 0.0.0.0:8000
9788
```
9889

@@ -110,7 +101,7 @@ Replace `<YOUR_VM_EXTERNAL_IP>` with the public IP address of your GCP VM.
110101

111102
You should see the Django welcome page with the message "The install worked successfully!":
112103

113-
![Screenshot of the Django welcome page displayed in a web browser. The page features a large heading stating The install worked successfully followed by a subheading congratulating the user on successfully installing Django. Below are instructions for the next steps, including editing the settings file and reading the Django documentation. The page has a clean white background with blue highlights. alt-text#center](images/django-welcome-page.png "Django welcome page")
104+
![Screenshot of the Django welcome page displayed in a web browser. The page features a large heading stating The install worked successfully followed by a subheading congratulating the user on successfully installing Django. Below are instructions for the next steps, including editing the settings file and reading the Django documentation. The page has a clean white background with blue highlights#center](images/django-welcome-page.png "Django welcome page")
114105

115106
## Build a simple Django app with custom routing
116107

@@ -124,7 +115,7 @@ Press **Ctrl + C** in your terminal to stop the Django development server.
124115

125116
Within your Django project directory, create a new app named `hello`:
126117

127-
```console
118+
```bash
128119
python3 manage.py startapp hello
129120
```
130121

@@ -148,7 +139,7 @@ Edit `hello/views.py` and replace the entire file with:
148139
from django.http import HttpResponse
149140

150141
def home(request):
151-
return HttpResponse("<h1>Hello, Django on Arm!</h1>")
142+
return HttpResponse("<h1>Hello, Django on GCP SUSE ARM64!</h1>")
152143
```
153144

154145
This simple view function returns a basic HTML message as an HTTP response.
@@ -220,7 +211,7 @@ INSTALLED_APPS = [
220211

221212
Restart the Django development server:
222213

223-
```console
214+
```bash
224215
python3 manage.py runserver 0.0.0.0:8000
225216
```
226217

@@ -234,8 +225,8 @@ http://<YOUR_VM_EXTERNAL_IP>:8000
234225

235226
You should now see your custom message displayed:
236227

237-
![Screenshot of a web browser displaying a Django app with a large heading that reads Hello, Django on Arm centered on a clean white background. The page contains no additional content or navigation, creating a straightforward and welcoming tone. alt-text#center](images/django-app.png "Django custom app")
228+
![Screenshot of a web browser displaying a Django app with a large heading that reads Hello, Django on Arm centered on a clean white background. The page contains no additional content or navigation, creating a straightforward and welcoming tone#center](images/django-app.png "Django custom app")
238229

239230
## Summary and what's next
240231

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!
232+
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.

0 commit comments

Comments
 (0)