﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27796	Middlewares load twice due to StaticFilesHandler(WSGIHandler)	Anthony King	Chandrakant Kumar	"In Django 1.10, a new middleware system was implemented. As part of this implementation, loading of middleware was moved to WSGIHandler.__init__.

When `django.contrib.staticfiles` is used, `StaticFilesHandler` is used as part of `runserver`, which causes `WSGIHandler.__init__` to be called twice.

This, in turn, causes the middlewares to all be initialised twice.

This will affect the majority of development environments. It should not affect production environments, as people should not be using `runserver`.

With the example middleware, you can see the class being initialised twice.

{{{#!python
# middleware.py
class ExampleMiddleware(MiddlewareMixin):

    def __init__(self, get_response=None):
        super().__init__(get_response=get_response)
        print(""simple_middleware - class: "", time.time(), self)
}}}"	Bug	closed	contrib.staticfiles	1.10	Normal	fixed			Ready for checkin	1	0	0	0	0	0
