diff --git a/src/core/urls.py b/src/core/urls.py index f0546ccc..ec5d16de 100644 --- a/src/core/urls.py +++ b/src/core/urls.py @@ -5,9 +5,11 @@ from core.views.static_views import ( community, documentation, + favicon, health_check, home, marker_generator, + robots_txt, ) from core.views.views import ( artwork_preview, @@ -16,7 +18,6 @@ exhibit_detail, exhibit_select, manifest, - robots_txt, see_all, service_worker, upload_image, @@ -46,7 +47,8 @@ path("upload", upload_image, name="upload-image"), path("i18n/", include("django.conf.urls.i18n")), path("see_all/", see_all, name="see_all"), - path("robots.txt/", robots_txt), + path("robots.txt", robots_txt), + path("favicon.ico", favicon), path(settings.HEALTH_CHECK_URL, health_check), path("/", exhibit, name="exhibit"), ] diff --git a/src/core/views/static_views.py b/src/core/views/static_views.py index e1bc971d..c7016f94 100644 --- a/src/core/views/static_views.py +++ b/src/core/views/static_views.py @@ -1,6 +1,6 @@ -from django.http import JsonResponse -from django.shortcuts import render - +from django.http import JsonResponse, HttpResponse +from django.shortcuts import redirect, render +from django.templatetags.static import static def home(request): return render(request, "users/profile.jinja2", {}) @@ -24,3 +24,15 @@ def marker_generator(request): def health_check(request): return JsonResponse({"status": "ok"}, status=200) + + +def favicon(request): + return redirect(static("images/icons/favicon.ico")) + + +def robots_txt(request): + lines = [ + "User-Agent: *", + "Disallow: ", + ] + return HttpResponse("\n".join(lines), content_type="text/plain") \ No newline at end of file diff --git a/src/core/views/views.py b/src/core/views/views.py index 289e8fa0..66eb3cab 100644 --- a/src/core/views/views.py +++ b/src/core/views/views.py @@ -123,15 +123,6 @@ def artwork_preview(request): return render(request, "core/exhibit.jinja2", ctx) -@require_http_methods(["GET"]) -def robots_txt(request): - lines = [ - "User-Agent: *", - "Disallow: ", - ] - return HttpResponse("\n".join(lines), content_type="text/plain") - - @require_http_methods(["GET"]) def exhibit(request, slug): exhibit = get_object_or_404(Exhibit.objects.prefetch_related("artworks"), slug=slug)