In the spirit of SEO, Django and this site I took the next step and added a robots.txt file. Nothing too exciting here, but I saw some postings on how to do it the wrong way that made me sad. Like serving the robots.txt file via Django. Why are you adding the overhead of django/mod_python to serve a static file?
Wrong Way:
Creating a view and having django render the template.
from django.shortcuts import render_to_response
def robots(request):
return render_to_response('robots.txt',
mimetype = 'text/plain')
The Right Way:
Have Apache serve the file directly. This site is hosted on WebFaction so you would have to load mod alias and point it at the path to your robots.txt
LoadModule alias_module modules/mod_alias.so
alias /robots.txt /full/path/to/robots.txt
<Location "/robots.txt">
SetHandler None
</Location>
My robots.txt file only has two lines, the first means it pertains to all robots, the second means to avoid the comments path. By default Django comments needs to be in your root url conf to work correctly, but it shouldn't be indexed.
User-agent: *
Disallow: /comments/
Or you could use a comfortable app with admin interface and let caching handle the overhead.
http://code.google.com/p/django-robots/ has a ROBOTS_CACHE_TIMEOUT setting.