﻿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
18577	Undocumented lazy middleware initialization	makuro@…	Łukasz Balcerzak	"The Django docs clearly state that:

> Unlike the process_* methods which get called once per request, !__init!__ gets called only once, when the Web server starts up.
([https://docs.djangoproject.com/en/dev/topics/http/middleware/#init link to docs])

However, I just traced a bug back to the fact that middleware is apparently initialized '''upon serving the first request'''.

To reproduce, you can simply add a non-existent middleware to your middleware classes in settings.py, and observe that the dev server starts up fine, but will barf upon serving the first request:
{{{
MIDDLEWARE_CLASSES = (
    'notreallyamiddleware',
    'django.middleware.common.CommonMiddleware'
)
}}}

I guess this could be chalked up to a documentation bug, but honestly, in one developer's opinion, initializing at startup would be preferable.

(This was observed on 1.3, but is probably also true of other versions.)"	Bug	closed	Documentation	1.3	Normal	fixed	middleware, settings	mahmoud@… kurose@…	Ready for checkin	1	0	0	0	1	0
