From ab0a1b267ca7534abfbd519c33a4d7638bd56165 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 15 Sep 2010 18:25:54 +0200 Subject: [PATCH] robots.txt --- pandora/static/robots.txt | 3 +++ pandora/urls.py | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 pandora/static/robots.txt diff --git a/pandora/static/robots.txt b/pandora/static/robots.txt new file mode 100644 index 0000000..6ffbc30 --- /dev/null +++ b/pandora/static/robots.txt @@ -0,0 +1,3 @@ +User-agent: * +Disallow: / + diff --git a/pandora/urls.py b/pandora/urls.py index b848fc6..d2f5293 100644 --- a/pandora/urls.py +++ b/pandora/urls.py @@ -1,4 +1,9 @@ +# -*- coding: utf-8 -*- +# vi:si:et:sw=4:sts=4:ts=4 +import os + from django.conf.urls.defaults import * +from oxdjango.http import HttpFileResponse from django.conf import settings @@ -6,9 +11,10 @@ from django.conf import settings from django.contrib import admin admin.autodiscover() +def serve_static_file(path, location, content_type): + return HttpFileResponse(location, content_type=content_type) urlpatterns = patterns('', - # Example: (r'^ajax_filtered_fields/', include('ajax_filtered_fields.urls')), (r'^api/upload/$', 'archive.views.firefogg_upload'), (r'^site.js$', 'app.views.site_js'), @@ -27,6 +33,8 @@ urlpatterns = patterns('', # Uncomment the next line to enable the admin: (r'^admin/(.*)', include(admin.site.urls)), + (r'^robots.txt$', serve_static_file, {'location': os.path.join(settings.STATIC_ROOT, 'robots.txt'), 'content_type': 'text/plain'}), + (r'^favicon.ico$', serve_static_file, {'location': os.path.join(settings.STATIC_ROOT, 'static/png/icon.16.png'), 'content_type': 'image/x-icon'}), ) if settings.DEBUG: