Serving robots.txt in django1.5
You could have served robots.txt in django<1.5 as follows :
url(http://coderwall.com/r'%5Erobots/.txt),%20direct_to_template,%20%7B'template':%20'robots.txt',%20'mimetype':%20'text/plain'%7D),
1.5 onwards, directtotemplate has been depricated, to directly serve it from urls.py use the following snippet:
from django.views.generic import TemplateView
url('http://coderwall.com/%5Erobots/.txt'),%20TemplateView.as_view(template_name='robots.txt',%20content_type='text/plain')),Written by Skate Hunbash
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#