Skip to content

Commit 4fb4a03

Browse files
authored
Merge pull request #11 from SpokaneTech/info_page
Info page
2 parents 0b69b15 + 41a58d2 commit 4fb4a03

File tree

4 files changed

+95
-1
lines changed

4 files changed

+95
-1
lines changed

src/django_project/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,5 +296,5 @@
296296
PROJECT_DESCRIPTION = (
297297
"""spokane_python is a super awesome project powered, in part, by amazing code provided by DjangoAddicts."""
298298
)
299-
PROJECT_VERSION = env.str("PROJECT_VERSION", "0.0.1")
299+
PROJECT_VERSION = env.str("IMAGE_TAG", "0.0.0")
300300
PROJECT_SOURCE = "https://github.com/SpokaneTech/SpokanePythonWeb"
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{% load static %}
2+
3+
<!DOCTYPE html>
4+
<html lang="en">
5+
6+
<head>
7+
<!-- Google tag (gtag.js) -->
8+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-X6VK8H1VLF"></script>
9+
<script>
10+
window.dataLayer = window.dataLayer || [];
11+
function gtag(){dataLayer.push(arguments);}
12+
gtag('js', new Date());
13+
14+
gtag('config', 'G-X6VK8H1VLF');
15+
</script>
16+
<meta charset="UTF-8">
17+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
18+
<meta name="description"
19+
content="Spokane's premiere local Python user group. Join us for meetups, workshops, and community events to learn and grow in Python programming.">
20+
<meta name="keywords" content="spokane, spokanetech, python, coding, software, developers, tech, technology">
21+
<meta property="og:title" content="Spokane Python User Group">
22+
<meta property="og:description"
23+
content="Spokane's premiere local Python user group. Join us for meetups, workshops, and community events to learn and grow in Python programming.">
24+
<meta name="robots" content="noindex, nofollow">
25+
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'spokanepython/img/favicon.png' %}">
26+
27+
<title>Spokane Python User Group</title>
28+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
29+
<link rel="stylesheet" href="{% static 'spokanepython/css/spug.css' %}">
30+
31+
</head>
32+
33+
<body>
34+
<section id="hero" class="p-5 d-flex justify-content-center" style="min-height: 100vh; background: linear-gradient(135deg, #3776AB 0%, #103069 100%);">
35+
<div class="container text-center p-2">
36+
<h1 class="display-3 text-white fw-bold"><span class="text-warning"><i class="fa-brands fa-python me-2"></i></span></h1>
37+
<h1 class="display-3 text-warning fw-bold"><span class="">Spokane Python User Group</span></h1>
38+
<!-- <h3 class="fw-bold text-warning py-3">Host Information</h3> -->
39+
<p class="my-4 lead fw-bold text-white">This page provides information about the host system running this application.</p>
40+
<div class="my-5">
41+
<div class="row mb-4">
42+
<span class="text-warning fw-bold">Start Time:</span>
43+
<span class="text-light">{{ HH_STARTTIME }}</span>
44+
</div>
45+
<div class="row mb-4">
46+
<span class="text-warning fw-bold">Version</span>
47+
<span class="text-light">{{ PROJECT_VERSION }}</span>
48+
</div>
49+
<div class="row mb-4">
50+
<span class="text-warning fw-bold">Python Version:</span>
51+
<span class="text-light">{{ python_version }}</span>
52+
</div>
53+
<div class="row mb-4">
54+
<span class="text-warning fw-bold">Django Version:</span>
55+
<span class="text-light">{{ django_version }}</span>
56+
</div>
57+
<div class="row mb-4">
58+
<span class="text-warning fw-bold">Hostname:</span>
59+
<span class="text-light">{{ hostname }}</span>
60+
</div>
61+
<div class="row mb-4">
62+
<span class="text-warning fw-bold">Source Code:</span>
63+
<span class="text-light"><a href="{{ source_code }}" target="_blank" class="text-light">{{ source_code }}</a></span>
64+
</div>
65+
<div class="row mb-4">
66+
<span class="text-warning fw-bold">Client IP Address:</span>
67+
<span class="text-light">{{ remote_ip_address }}</span>
68+
</div>
69+
<div class="row mb-4">
70+
<span class="text-warning fw-bold">Client User Agent:</span>
71+
<span class="text-light">{{ user_agent }}</span>
72+
</div>
73+
</div>
74+
</div>
75+
</section>
76+
</body>
77+
</html>

src/django_project/web/urls/gui.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
path("index/", gui.IndexView.as_view(), name="index"),
88
path("default/", gui.IndexView.as_view(), name="default"),
99
path("home/", gui.IndexView.as_view(), name="home"),
10+
path("host/", gui.HostView.as_view(), name="host_info"),
1011
# HTMX views
1112
path("htmx/resource-list/<int:pk>/", gui.ResourceListPartialView.as_view(), name="htmx_resource_list"),
1213
path("htmx/past-events/", gui.PastEventsPartialView.as_view(), name="htmx_past_events"),

src/django_project/web/views/gui.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import sys
12
from typing import Any
23

4+
import django
5+
from django.conf import settings
36
from django.db.models.manager import BaseManager
47
from django.http import HttpResponse
58
from django.shortcuts import render
@@ -15,6 +18,19 @@ class IndexView(TemplateView):
1518
template_name = "web/full/index.html"
1619

1720

21+
class HostView(View):
22+
def get(self, request) -> HttpResponse:
23+
host_info: dict[str, str] = {
24+
"hostname": request.get_host(),
25+
"remote_ip_address": request.META.get("REMOTE_ADDR", "Unknown"),
26+
"user_agent": request.META.get("HTTP_USER_AGENT", "Unknown"),
27+
"source_code": getattr(settings, "PROJECT_SOURCE", "Unknown"),
28+
"python_version": f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
29+
"django_version": django.get_version(),
30+
}
31+
return render(request, "web/full/host_info.html", host_info)
32+
33+
1834
class ResourceListPartialView(View):
1935
def get(self, request, pk) -> HttpResponse:
2036
category: Any = ResourceCategory.objects.get_object_or_none(pk=pk)

0 commit comments

Comments
 (0)