From 143cde64b1a89a67113d1bd775bd069eb37affbd Mon Sep 17 00:00:00 2001 From: Michael Guse Date: Thu, 28 Nov 2024 11:36:42 -0600 Subject: [PATCH 1/3] Updated index view --- hello/views.py | 5 ++++- requirements.txt | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hello/views.py b/hello/views.py index bd7a34b00..6363dbe4e 100644 --- a/hello/views.py +++ b/hello/views.py @@ -1,3 +1,5 @@ +import requests +from django.http import HttpResponse from django.shortcuts import render from .models import Greeting @@ -6,7 +8,8 @@ def index(request): - return render(request, "index.html") + r = requests.get('https://httpbin.org/status/418', timeout=10) + return HttpResponse('
' + r.text + '
') def db(request): diff --git a/requirements.txt b/requirements.txt index c420fa54c..952d83e8b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ django>=5.1,<5.2 gunicorn>=23,<24 dj-database-url>=2,<3 whitenoise[brotli]>=6,<7 +requests # Uncomment these lines to use a Postgres database. Both are needed, since in production # (which uses Linux) we want to install from source, so that security updates from the From 98a6c1dd8abb1aaf161786420c52a9cc1c0844d5 Mon Sep 17 00:00:00 2001 From: Michael Guse Date: Thu, 28 Nov 2024 11:51:12 -0600 Subject: [PATCH 2/3] Changed config var to 5 --- hello/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hello/views.py b/hello/views.py index 6363dbe4e..3b765e4cb 100644 --- a/hello/views.py +++ b/hello/views.py @@ -1,4 +1,5 @@ import requests +import os from django.http import HttpResponse from django.shortcuts import render @@ -8,8 +9,8 @@ def index(request): - r = requests.get('https://httpbin.org/status/418', timeout=10) - return HttpResponse('
' + r.text + '
') + times = int(os.environ.get('TIMES', 3)) + return HttpResponse('Hello! ' * times) def db(request): From afeb11f0f8a4142b87b791bd1affc84af053d535 Mon Sep 17 00:00:00 2001 From: Michael Guse Date: Mon, 2 Dec 2024 16:35:48 -0600 Subject: [PATCH 3/3] Changed config var default to 4 (#1) --- hello/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hello/views.py b/hello/views.py index 3b765e4cb..3b94dc29c 100644 --- a/hello/views.py +++ b/hello/views.py @@ -9,7 +9,7 @@ def index(request): - times = int(os.environ.get('TIMES', 3)) + times = int(os.environ.get('TIMES', 4)) return HttpResponse('Hello! ' * times)