Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/django_project/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
77 changes: 77 additions & 0 deletions src/django_project/web/templates/web/full/host_info.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{% load static %}

<!DOCTYPE html>
<html lang="en">

<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-X6VK8H1VLF"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-X6VK8H1VLF');
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
content="Spokane's premiere local Python user group. Join us for meetups, workshops, and community events to learn and grow in Python programming.">
<meta name="keywords" content="spokane, spokanetech, python, coding, software, developers, tech, technology">
<meta property="og:title" content="Spokane Python User Group">
<meta property="og:description"
content="Spokane's premiere local Python user group. Join us for meetups, workshops, and community events to learn and grow in Python programming.">
<meta name="robots" content="noindex, nofollow">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'spokanepython/img/favicon.png' %}">

<title>Spokane Python User Group</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<link rel="stylesheet" href="{% static 'spokanepython/css/spug.css' %}">

</head>

<body>
<section id="hero" class="p-5 d-flex justify-content-center" style="min-height: 100vh; background: linear-gradient(135deg, #3776AB 0%, #103069 100%);">
<div class="container text-center p-2">
<h1 class="display-3 text-white fw-bold"><span class="text-warning"><i class="fa-brands fa-python me-2"></i></span></h1>
<h1 class="display-3 text-warning fw-bold"><span class="">Spokane Python User Group</span></h1>
<!-- <h3 class="fw-bold text-warning py-3">Host Information</h3> -->
<p class="my-4 lead fw-bold text-white">This page provides information about the host system running this application.</p>
<div class="my-5">
<div class="row mb-4">
<span class="text-warning fw-bold">Start Time:</span>
<span class="text-light">{{ HH_STARTTIME }}</span>
</div>
<div class="row mb-4">
<span class="text-warning fw-bold">Version</span>
<span class="text-light">{{ PROJECT_VERSION }}</span>
</div>
<div class="row mb-4">
<span class="text-warning fw-bold">Python Version:</span>
<span class="text-light">{{ python_version }}</span>
</div>
<div class="row mb-4">
<span class="text-warning fw-bold">Django Version:</span>
<span class="text-light">{{ django_version }}</span>
</div>
<div class="row mb-4">
<span class="text-warning fw-bold">Hostname:</span>
<span class="text-light">{{ hostname }}</span>
</div>
<div class="row mb-4">
<span class="text-warning fw-bold">Source Code:</span>
<span class="text-light"><a href="{{ source_code }}" target="_blank" class="text-light">{{ source_code }}</a></span>
</div>
<div class="row mb-4">
<span class="text-warning fw-bold">Client IP Address:</span>
<span class="text-light">{{ remote_ip_address }}</span>
</div>
<div class="row mb-4">
<span class="text-warning fw-bold">Client User Agent:</span>
<span class="text-light">{{ user_agent }}</span>
</div>
</div>
</div>
</section>
</body>
</html>
1 change: 1 addition & 0 deletions src/django_project/web/urls/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/<int:pk>/", gui.ResourceListPartialView.as_view(), name="htmx_resource_list"),
path("htmx/past-events/", gui.PastEventsPartialView.as_view(), name="htmx_past_events"),
Expand Down
16 changes: 16 additions & 0 deletions src/django_project/web/views/gui.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down