diff --git a/pyproject.toml b/pyproject.toml index 6166494..e54bd50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] dependencies = [ - "django~=5.2.12", + "django~=5.2.13", "django-braces", "django-debug-toolbar", "django-environ", @@ -18,7 +18,7 @@ description = "Spokane Python Community" dynamic = ["version"] keywords = ["django"] license = {file = "LICENSE"} -name = "my_django_project" +name = "SpokanePythonCommunity" readme = "README.md" requires-python = ">=3.12" diff --git a/src/django_project/core/settings.py b/src/django_project/core/settings.py index 21fe367..5a4fe92 100644 --- a/src/django_project/core/settings.py +++ b/src/django_project/core/settings.py @@ -54,6 +54,7 @@ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", + "django.contrib.sitemaps", # third party apps "django_extensions", "django_filters", diff --git a/src/django_project/core/urls/urls.py b/src/django_project/core/urls/urls.py index 6cfcfe9..30700c5 100644 --- a/src/django_project/core/urls/urls.py +++ b/src/django_project/core/urls/urls.py @@ -17,12 +17,14 @@ from core.views import robots_txt from django.conf import settings from django.contrib import admin +from django.contrib.sitemaps.views import sitemap from django.urls import include, path from drf_spectacular.views import ( SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView, ) +from web.sitemaps import sitemaps urlpatterns = [ # Django provided URLs @@ -35,8 +37,9 @@ path("rest/schema/", SpectacularAPIView.as_view(), name="schema"), path("rest/swagger/", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger"), path("rest/redoc/", SpectacularRedocView.as_view(url_name="schema"), name="redoc"), - # project level URLs + # SEO URLs path("robots.txt", robots_txt), + path("sitemap.xml", sitemap, {"sitemaps": sitemaps}, name="django.contrib.sitemaps.views.sitemap"), # URLs to local apps path("", include("web.urls", namespace="web")), ] diff --git a/src/django_project/core/views.py b/src/django_project/core/views.py index dcdb286..0a8b28c 100644 --- a/src/django_project/core/views.py +++ b/src/django_project/core/views.py @@ -12,4 +12,5 @@ def robots_txt(request) -> HttpResponse: Disallow: /__debug__/ Disallow: /accounts/ Disallow: /admin/ +Sitemap: https://spokanepython.com/sitemap.xml """ diff --git a/src/django_project/web/sitemaps.py b/src/django_project/web/sitemaps.py new file mode 100644 index 0000000..b849f64 --- /dev/null +++ b/src/django_project/web/sitemaps.py @@ -0,0 +1,19 @@ +from django.contrib.sitemaps import Sitemap + + +class StaticViewSitemap(Sitemap): + """Sitemap for static pages.""" + + priority = 1.0 + changefreq = "daily" + + def items(self) -> list[str]: + return ["/"] + + def location(self, item: str) -> str: + return item + + +sitemaps = { + "static": StaticViewSitemap, +} diff --git a/src/django_project/web/templates/web/full/index.html b/src/django_project/web/templates/web/full/index.html index ce0bbe7..fed86b3 100644 --- a/src/django_project/web/templates/web/full/index.html +++ b/src/django_project/web/templates/web/full/index.html @@ -23,11 +23,25 @@ - + + + + + + + + + + Spokane Python User Group - + + + + + + @@ -37,8 +51,6 @@ background-color: #f1f1f1 } - @import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;700&display=swap'); - body { font-family: 'Ubuntu', Arial, sans-serif; padding-top: 70px; @@ -135,6 +147,24 @@ } + + + diff --git a/src/django_project/web/templates/web/partials/future_events.htm b/src/django_project/web/templates/web/partials/future_events.htm index f5f76cf..bb8bf1c 100644 --- a/src/django_project/web/templates/web/partials/future_events.htm +++ b/src/django_project/web/templates/web/partials/future_events.htm @@ -1,4 +1,24 @@ {% for event in events %} +

{{ event.name }}

diff --git a/src/docker/Dockerfile b/src/docker/Dockerfile index 8a73246..b16b3fa 100644 --- a/src/docker/Dockerfile +++ b/src/docker/Dockerfile @@ -1,5 +1,5 @@ # === STAGE 1: Build dependencies in a virtual environment === -FROM python:3.12-alpine AS builder +FROM python:3.13-alpine AS builder WORKDIR /app @@ -20,7 +20,7 @@ RUN pip install .[docker] # === STAGE 2: Runtime with only necessary files === -FROM python:3.12-alpine +FROM python:3.13-alpine ARG IMAGE_TAG=dev ENV IMAGE_TAG=${IMAGE_TAG}