Skip to content
This repository was archived by the owner on Mar 1, 2022. It is now read-only.

Commit 6d10746

Browse files
author
Fred Wenzel
committed
Adding robots.txt file to keep bots from crawling certain parts of the site. Bug 665231.
1 parent 8f28b15 commit 6d10746

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

ffdemo/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
USE_L10N = True
4040

4141
# Paths that don't require a locale prefix.
42-
SUPPORTED_NONLOCALES = ('media', 'admin', 'requests', 'accounts', 'moderate')
42+
SUPPORTED_NONLOCALES = ('media', 'admin', 'requests', 'accounts', 'moderate',
43+
'robots.txt')
4344

4445
# Gettext text domain
4546
TEXT_DOMAIN = 'django'

ffdemo/templates_orig/robots.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
User-agent: *
2+
Disallow: /localeurl/
3+
Disallow: /i18n/
4+
Disallow: /linear_sammy.html
5+
Disallow: /makemark_sammy.html
6+
Disallow: /mark/
7+
Disallow: /gml/
8+
Disallow: /accounts/
9+
Disallow: /list_invites/
10+
Disallow: /moderate/
11+
Disallow: /requests/
12+
Disallow: /newsletter/subscribe/

ffdemo/urls.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import django
22
from django.conf.urls.defaults import *
33
from django.conf import settings
4+
from django.views.generic.simple import direct_to_template
45

56
# Uncomment the next two lines to enable the admin:
67
#from django.contrib import admin
@@ -9,6 +10,8 @@
910
urlpatterns = patterns('',
1011
(r'^localeurl/', include('localeurl.urls')),
1112
(r'^i18n/', include('django.conf.urls.i18n')),
13+
(r'^robots\.txt$', direct_to_template, {'template': 'robots.txt',
14+
'mimetype': 'text/plain'}),
1215
)
1316

1417
if settings.DEBUG:

0 commit comments

Comments
 (0)