From 97c1c8f89c2f5bd820277fe106e572d619a0a914 Mon Sep 17 00:00:00 2001 From: William Zhang Date: Tue, 8 May 2018 21:27:35 -0400 Subject: [PATCH] add robots.txt --- robots.txt => sgawebsite/templates/robots.txt | 0 sgawebsite/urls.py | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) rename robots.txt => sgawebsite/templates/robots.txt (100%) diff --git a/robots.txt b/sgawebsite/templates/robots.txt similarity index 100% rename from robots.txt rename to sgawebsite/templates/robots.txt diff --git a/sgawebsite/urls.py b/sgawebsite/urls.py index 6ca7066..37738a2 100644 --- a/sgawebsite/urls.py +++ b/sgawebsite/urls.py @@ -14,6 +14,7 @@ Including another URLconf 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import include, url +from django.views.generic.simple import direct_to_template from django.contrib import admin from .apps.main import urls as main import requests @@ -28,5 +29,6 @@ with open("forms.json", 'w') as f: urlpatterns = [ url(r'^admin/', admin.site.urls), - url(r'^', include(main)) + url(r'^', include(main)), + url(r'^robots\.txt$', direct_to_template, {'template': 'robots.txt', 'mimetype': 'text/plain'}) ]