Thanks for your reply Tim.
I have tried the code provided, but it seems that the cache is not deleted.
I am testing the code in development, which uses django.core.cache.backends.locmem.LocMemCache. I don't know if that makes any difference.
Also, I have noticed that the path in url.path used in request = rf.get(url.path, secure=is_secure) is not an absolute path containing the host name. While searching around, some posts suggested that the path needs to include also the host name for django 1.7+. But doing that didn't change anything.
I tried using cache.has_key(cache_key) just before calling the delete to check if a key exists, which returns False.