django redirect key intermediate

1, defined and registered middleware

  Use the registration of middleware:

  from django.http import HttpResponseRedirect

   '' 'The following method of writing will fall into an infinite loop, it must be added to determine the condition is called only once' ''

   def process_request(self,request):

    return HttpResponseRedirect ( '/ QQ / test') # can be written website can also write the local relative path

2, to determine whether to include session, should pay attention to when writing the above method to determine the redirection will be called once again, it must be added to determine the redirection is invoked only once, otherwise it will fall into an infinite loop

Guess you like

Origin www.cnblogs.com/yitd/p/11829190.html