From 949f617f423c6440cb79e24d49f3b36747680f97 Mon Sep 17 00:00:00 2001 From: Aamir Khan Date: Wed, 27 Jun 2012 17:54:52 -0400 Subject: Making robots.txt work --- robots.txt | 4 ---- templates/robots.txt | 4 ++++ urls.py | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) delete mode 100644 robots.txt create mode 100644 templates/robots.txt diff --git a/robots.txt b/robots.txt deleted file mode 100644 index 5fe5da1..0000000 --- a/robots.txt +++ /dev/null @@ -1,4 +0,0 @@ -User-agent: * -Disallow: /accounts/ -Disallow: /admin/ -Disallow: /vote/ diff --git a/templates/robots.txt b/templates/robots.txt new file mode 100644 index 0000000..5fe5da1 --- /dev/null +++ b/templates/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Disallow: /accounts/ +Disallow: /admin/ +Disallow: /vote/ diff --git a/urls.py b/urls.py index 6f2ef92..747b1d0 100644 --- a/urls.py +++ b/urls.py @@ -1,5 +1,6 @@ from django.conf.urls.defaults import patterns, include, url from django.conf import settings +from django.views.generic.simple import direct_to_template from api import EmailResource, ThreadResource, SearchResource from django.contrib.staticfiles.urls import staticfiles_urlpatterns @@ -90,6 +91,10 @@ urlpatterns = patterns('', # Admin url(r'^admin/', include(admin.site.urls)), + # Robots.txt + url(r'^robots\.txt$', direct_to_template, + {'template': 'robots.txt', 'mimetype': 'text/plain'}), + # Social Auth url(r'', include('social_auth.urls')), -- cgit