1

Here is what we have in our url conf:

from django.views.generic import TemplateView

.....

url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.html')),

For some reason, we're getting redirected to ?next=robots.txt when attempting to hit *.com/robots.txt

Is there something obvious we're missing ? This seems to work locally in vagrant environments but it's not working in production (redirecting through ?next=)

update 1 There is no obvious reason that this would be behind a @login_required decorator or any required login function...

update 2 Sure enough, you can see robots.txt when you are authenticated....

update 3 direct_to_template has been deprecated, I'm sure that used to work but apparently has been deprecated in django 1.5

update 4 seems like this post has a way to force login_required for a TemplateView.as_view: How to require login for Django Generic Views? but it seems in our case this is being force by default ?

Community
  • 1
  • 1
Wade Williams
  • 3,943
  • 1
  • 26
  • 35
  • idk why TemplateView is requiring a login, but if you need to get it working you can just set up a normal function view and render your template that way, or if your file is not being dynamically generated, it should be served usign your webserver not through django – dm03514 May 28 '13 at 22:52
  • 1
    Do you have any middleware installed that might be interfering? – Chris Lawlor May 31 '13 at 18:50

0 Answers0