def from_settings(cls, settings, engine): """ Build middleware pipeline from settings """ mwlist = cls._get_mwlist_from_settings(settings) middlewares = [] for clspath in mwlist: try: mwcls = utils.load_object(clspath) if hasattr(mwcls, 'from_settings'): mw = mwcls.from_settings(settings, engine) else: mw = mwcls(engine) middlewares.append(mw) except NotConfigured, e: if e.args: clsname = clspath.split('.')[-1] log.msg('Disabled %s: %s' % (clsname, e.args[0]))
def __init__(self): imageproc_cls = utils.load_object(settings.IMAGE_PROCESSOR) self.imageproc = imageproc_cls.from_settings(settings, self) statsd.Connection.set_defaults(host=settings.STATSD_HOST, port=settings.STATSD_PORT, sample_rate=1)