-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I'm trying to expire cache for news pages after they've been edited by an administrator.
With this code
@receiver(post_save, sender=News)
def on_change(instance, **kwargs):
expire_page(reverse('press:news_item', args=(instance.pk,)))
I'm getting the KeyError:
File "project/apps/press/models.py", line 157, in on_change
expire_page(reverse('press:news item', args=(instance.pk,)))
File "venv/local/lib/python2.7/site-packages/cache_tools/tools.py", line 13, in expire_page
key = get_cache_key(request)
File "venv/local/lib/python2.7/site-packages/django/utils/cache.py", line 220, in get_cache_key
cache_key = _generate_cache_header_key(key_prefix, request)
File "venv/local/lib/python2.7/site-packages/django/utils/cache.py", line 202, in _generate_cache_header_key
url = hashlib.md5(force_bytes(iri_to_uri(request.build_absolute_uri())))
File "venv/local/lib/python2.7/site-packages/django/http/request.py", line 130, in build_absolute_uri
self.get_host(), self.path)
File "venv/local/lib/python2.7/site-packages/django/http/request.py", line 72, in get_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
viktoradavid
Metadata
Metadata
Assignees
Labels
No labels