[Answer]-Django robot.txt error

1👍

You are trying to access robot.txt instead of robots.txt.

You should access http://localhost/127.0.0.1:8000/robots.txt

👤Rohan

0👍

by the way it should be in urls.py not in views.py.

like this:

from django.http import HttpResponse

urlpatterns = patterns('',
    ...
    (r'^robots\.txt$', lambda r: HttpResponse("User-agent: *\nDisallow: /", mimetype="text/plain"))
)

Leave a comment