Skip to content

Commit

Permalink
[#273] Add robots.txt for live and dev environments
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed Mar 24, 2016
1 parent 36edbac commit a78e69d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions akvo/templates/robots/dev-robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Disallow: /
2 changes: 2 additions & 0 deletions akvo/templates/robots/live-robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Allow: /
15 changes: 15 additions & 0 deletions akvo/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,18 @@

if settings.REQUIRED_AUTH_GROUPS:
check_auth_groups(settings.REQUIRED_AUTH_GROUPS)


# Robots.txt
if settings.DEBUG:
urlpatterns += patterns(
'',
url(r'^robots\.txt$',
TemplateView.as_view(template_name='robots/dev-robots.txt', content_type='text/plain'))
)
else:
urlpatterns += patterns(
'',
url(r'^robots\.txt$',
TemplateView.as_view(template_name='robots/live-robots.txt', content_type='text/plain'))
)

0 comments on commit a78e69d

Please sign in to comment.