#coding=utf-8 from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect def index(request): user_id = request.META.get('HTTP_USER_ID') token = request.META.get('HTTP_ACCESS_TOKEN') if not user_id or not token: return HttpResponseRedirect('/views/account/login.html') else: return HttpResponsePermanentRedirect("/views/index.html")