Make middleware handle dynamic settings changes, and be less tolerant of invalid settings.

* Abstract base class factored out of middleware classes
* All middleware now responds to dynamic setting changes via the change_setting signal
* Middleware now raises ImproperlyConfigured for missing/invalid settings, instead of silently disabling itself. This may break code that was previously ignoring these errors.