From 777a730d9fb98299f90641db5256cd3bc35a68a1 Mon Sep 17 00:00:00 2001 From: Jonas Carson Date: Thu, 21 Nov 2024 12:39:40 -0800 Subject: [PATCH] Add redirectview for favicon.ico to our custom favicon. Make redirect view not login protected --- config/settings/base.py | 1 + config/urls.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/config/settings/base.py b/config/settings/base.py index f62767cc..6dc1850a 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -298,6 +298,7 @@ "socialaccount_signup", "admin:index", "admin:login", + "favicon" ] # django-dbbackup diff --git a/config/urls.py b/config/urls.py index c5982f85..28948cce 100644 --- a/config/urls.py +++ b/config/urls.py @@ -1,9 +1,11 @@ from django.conf import settings from django.conf.urls.static import static +from django.templatetags.static import static as static_url_tag from django.contrib import admin from django.urls import include, path from django.views import defaults as default_views from django.views.generic import TemplateView +from django.views.generic.base import RedirectView urlpatterns = [ path("", TemplateView.as_view(template_name="pages/home.html"), name="home"), @@ -22,6 +24,7 @@ "gregor_anvil/", include("gregor_django.gregor_anvil.urls", namespace="gregor_anvil"), ), + path("favicon.ico", RedirectView.as_view(url=static_url_tag("images/favicons/favicon_1.jpg"), permanent=True), name="favicon"), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)