django-robots icon indicating copy to clipboard operation
django-robots copied to clipboard

django-robots without SITE_ID set gives an error on django 2.0

Open gfhuseyinyilmaz opened this issue 7 years ago • 1 comments

To repeat this.

  1. Make sure django goversion is 2.X or above
  2. Make sure SITE_ID is not set.
  3. Make sure ROBOTS_SITE_BY_REQUEST is not set on settings.

/robots.txt endpoint gives following error:

You're using the Django "sites framework" without having set the SITE_ID setting. Create a site in your database and set the SITE_ID setting or pass a request to Site.objects.get_current() to fix this error.

It would be nice if SITE_ID is not set django's default behaviour would work. Error is coming from this line:

https://github.com/jazzband/django-robots/blob/f484c2a6abcae6244f860ad077af28d4be62037e/robots/views.py#L29

gfhuseyinyilmaz avatar Dec 16 '17 18:12 gfhuseyinyilmaz

Why not set ROBOTS_SITE_BY_REQUEST?

ogonkov avatar Jun 06 '18 12:06 ogonkov