|
@@ -2,6 +2,7 @@ from ipaddress import ip_address
|
|
|
|
|
|
|
|
|
from django.http import HttpResponse
|
|
|
+from django.template import loader
|
|
|
|
|
|
|
|
|
def get_client_ip(request):
|
|
@@ -13,17 +14,21 @@ def get_client_ip(request):
|
|
|
return ip
|
|
|
|
|
|
|
|
|
-def no_cats_here():
|
|
|
- return HttpResponse("no cats purring here, only via ipv6")
|
|
|
+#def no_cats_here():
|
|
|
+# return HttpResponse("no cats purring here, only via ipv6")
|
|
|
|
|
|
|
|
|
-def cute_cat():
|
|
|
- return HttpResponse("purrr ...")
|
|
|
+def cute_cat(request):
|
|
|
+ template = loader.get_template("catster/index.html")
|
|
|
+ context = {}
|
|
|
+ return HttpResponse(
|
|
|
+ template.render(context, request)
|
|
|
+ )
|
|
|
|
|
|
|
|
|
def index(request):
|
|
|
ip = get_client_ip(request)
|
|
|
- if ip_address(ip).version == 4:
|
|
|
- return no_cats_here()
|
|
|
+ #if ip_address(ip).version == 4:
|
|
|
+ # return no_cats_here()
|
|
|
|
|
|
- return cute_cat()
|
|
|
+ return cute_cat(request)
|