django-robots
django-robots copied to clipboard
django-robots without SITE_ID set gives an error on django 2.0
To repeat this.
- Make sure django goversion is 2.X or above
- Make sure SITE_ID is not set.
- 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
Why not set ROBOTS_SITE_BY_REQUEST
?