I have special middleware that is called twice for each request, and I donβt understand why. This is my middleware:
class MyMiddleWare(object): def process_request(self, request): print 'FOO' return None
This is my middleware setup:
MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'MyMiddleware', )
And this is the result in the console after a request to the home page:
[28/Jun/2013 19:48:26] FOO [28/Jun/2013 19:48:26] "GET / HTTP/1.1" 200 7468 [28/Jun/2013 19:48:27] FOO
I tried to comment on all the other average problems, and the problem is the same. What should I do?
ps: the described behavior is reproduced in each view
UPDATE
I tried to implement process_view , not process_request , and it is called once, as expected ... why?
UPDATE 2 :
process_response is called twice as process_request
UDATE 3 :
ooooh shiiiit! This is a request to favicon.ico (which I have not yet defined) ... which calls this file?
source share