I have a custom middleware which is called twice for every 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 setting:
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 output in the console after homepage request:
[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 out all the other middlewares and the problem is the same. What should I do?
ps: the described behavior is replicable in each view
UPDATE:
I tried to implement process_view
rather than process_request
and it is called once as expected... why?
UPDATE 2:
process_response
is called twice like process_request
UDATE 3:
ooooh shiiiit! It's a request to favicon.ico (which I haven't defined myself)... who is calling this file?