'NoneType' object has no attribute 'startswith'. so check before using

During cache miss, avoid the possibility of getting a 500 Internal Server Error.
Making sure self.request.referer is not of NoneType before using startswith()