diff --git a/src/django_project/core/settings.py b/src/django_project/core/settings.py index 6236cf4..c6a0cf6 100644 --- a/src/django_project/core/settings.py +++ b/src/django_project/core/settings.py @@ -296,5 +296,5 @@ PROJECT_DESCRIPTION = ( """spokane_python is a super awesome project powered, in part, by amazing code provided by DjangoAddicts.""" ) -PROJECT_VERSION = env.str("PROJECT_VERSION", "0.0.1") +PROJECT_VERSION = env.str("IMAGE_TAG", "0.0.0") PROJECT_SOURCE = "https://github.com/SpokaneTech/SpokanePythonWeb" diff --git a/src/django_project/web/templates/web/full/host_info.html b/src/django_project/web/templates/web/full/host_info.html new file mode 100644 index 0000000..6fd0a10 --- /dev/null +++ b/src/django_project/web/templates/web/full/host_info.html @@ -0,0 +1,77 @@ +{% load static %} + + + + + + + + + + + + + + + + + + Spokane Python User Group + + + + + + +
+
+

+

Spokane Python User Group

+ +

This page provides information about the host system running this application.

+
+
+ Start Time: + {{ HH_STARTTIME }} +
+
+ Version + {{ PROJECT_VERSION }} +
+
+ Python Version: + {{ python_version }} +
+
+ Django Version: + {{ django_version }} +
+
+ Hostname: + {{ hostname }} +
+
+ Source Code: + {{ source_code }} +
+
+ Client IP Address: + {{ remote_ip_address }} +
+
+ Client User Agent: + {{ user_agent }} +
+
+
+
+ + diff --git a/src/django_project/web/urls/gui.py b/src/django_project/web/urls/gui.py index 8dea15d..1419009 100644 --- a/src/django_project/web/urls/gui.py +++ b/src/django_project/web/urls/gui.py @@ -7,6 +7,7 @@ path("index/", gui.IndexView.as_view(), name="index"), path("default/", gui.IndexView.as_view(), name="default"), path("home/", gui.IndexView.as_view(), name="home"), + path("host/", gui.HostView.as_view(), name="host_info"), # HTMX views path("htmx/resource-list//", gui.ResourceListPartialView.as_view(), name="htmx_resource_list"), path("htmx/past-events/", gui.PastEventsPartialView.as_view(), name="htmx_past_events"), diff --git a/src/django_project/web/views/gui.py b/src/django_project/web/views/gui.py index d48ed31..a4438df 100644 --- a/src/django_project/web/views/gui.py +++ b/src/django_project/web/views/gui.py @@ -1,5 +1,8 @@ +import sys from typing import Any +import django +from django.conf import settings from django.db.models.manager import BaseManager from django.http import HttpResponse from django.shortcuts import render @@ -15,6 +18,19 @@ class IndexView(TemplateView): template_name = "web/full/index.html" +class HostView(View): + def get(self, request) -> HttpResponse: + host_info: dict[str, str] = { + "hostname": request.get_host(), + "remote_ip_address": request.META.get("REMOTE_ADDR", "Unknown"), + "user_agent": request.META.get("HTTP_USER_AGENT", "Unknown"), + "source_code": getattr(settings, "PROJECT_SOURCE", "Unknown"), + "python_version": f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}", + "django_version": django.get_version(), + } + return render(request, "web/full/host_info.html", host_info) + + class ResourceListPartialView(View): def get(self, request, pk) -> HttpResponse: category: Any = ResourceCategory.objects.get_object_or_none(pk=pk)