application_factories and DispatcherMiddleware