• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python config.Config类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中thumbor.config.Config的典型用法代码示例。如果您正苦于以下问题:Python Config类的具体用法?Python Config怎么用?Python Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Config类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_app

    def get_app(self):
        cfg = Config(SECURITY_KEY='ACME-SEC')
        server_params = ServerParameters(None, None, None, None, None, None)
        server_params.gifsicle_path = which('gifsicle')

        cfg.DETECTORS = [
            'thumbor.detectors.face_detector',
            'thumbor.detectors.profile_detector',
            'thumbor.detectors.glasses_detector',
            'thumbor.detectors.feature_detector',
        ]
        cfg.STORAGE = 'thumbor.storages.no_storage'
        cfg.LOADER = 'thumbor.loaders.file_loader'
        cfg.FILE_LOADER_ROOT_PATH = os.path.join(os.path.dirname(__file__), 'imgs')
        cfg.ENGINE = getattr(self, 'engine', None)
        cfg.USE_GIFSICLE_ENGINE = True
        cfg.FFMPEG_PATH = which('ffmpeg')
        cfg.ENGINE_THREADPOOL_SIZE = 10
        cfg.OPTIMIZERS = [
            'thumbor.optimizers.gifv',
        ]
        if not cfg.ENGINE:
            return None

        importer = Importer(cfg)
        importer.import_modules()
        ctx = Context(server_params, cfg, importer)
        application = ThumborServiceApp(ctx)

        return application
开发者ID:Bladrak,项目名称:thumbor,代码行数:30,代码来源:__init__.py


示例2: test_with_aliased_aliases

 def test_with_aliased_aliases(self):
     Config.alias('STORAGE_ALIAS', 'STORAGE')
     Config.alias('STORAGE_ALIAS_ALIAS', 'STORAGE_ALIAS')
     cfg = Config(STORAGE_ALIAS_ALIAS='z')
     expect(cfg.STORAGE).to_equal('z')
     expect(cfg.STORAGE_ALIAS).to_equal('z')
     expect(cfg.STORAGE_ALIAS_ALIAS).to_equal('z')
开发者ID:RealGeeks,项目名称:thumbor,代码行数:7,代码来源:test_config.py


示例3: topic

 def topic(self):
     conf = Config()
     conf.ENGINE = 'thumbor.engines.pil'
     imp = Importer(conf)
     imp.import_modules()
     imp.filters = [Filter]
     return Context(None, conf, imp)
开发者ID:achellies,项目名称:thumbor,代码行数:7,代码来源:fill_filter_vows.py


示例4: test_with_allowed_sources

 def test_with_allowed_sources(self):
     config = Config()
     config.ALLOWED_SOURCES = [
         's.glbimg.com',
         re.compile(r'https://www\.google\.com/img/.*')
     ]
     ctx = Context(None, config, None)
     expect(
         loader.validate(
             ctx,
             'http://www.google.com/logo.jpg'
         )
     ).to_be_false()
     expect(
         loader.validate(
             ctx,
             'http://s2.glbimg.com/logo.jpg'
         )
     ).to_be_false()
     expect(
         loader.validate(
             ctx,
             '/glob=:sfoir%20%20%3Co-pmb%20%20%20%20_%20%20%20%200%20%20g.-%3E%3Ca%20hplass='
         )
     ).to_be_false()
     expect(
         loader.validate(
             ctx,
             'https://www.google.com/img/logo.jpg'
         )
     ).to_be_true()
     expect(
         loader.validate(ctx, 'http://s.glbimg.com/logo.jpg')).to_be_true()
开发者ID:caeugusmao,项目名称:thumbor,代码行数:33,代码来源:test_http_loader.py


示例5: get_context

def get_context():
    conf = Config()
    conf.ENGINE = "thumbor.engines.pil"
    imp = Importer(conf)
    imp.import_modules()
    imp.filters = [Filter]
    return Context(None, conf, imp)
开发者ID:expertise-com,项目名称:thumbor,代码行数:7,代码来源:fill_filter_vows.py


示例6: get_context

    def get_context(self):
        cfg = Config(SECURITY_KEY="ACME-SEC", ENGINE="thumbor.engines.pil", IMAGE_METADATA_READ_FORMATS="exif,xmp")
        cfg.LOADER = "thumbor.loaders.file_loader"
        cfg.FILE_LOADER_ROOT_PATH = STORAGE_PATH
        cfg.STORAGE = "thumbor.storages.no_storage"

        return Context(config=cfg)
开发者ID:thumbor,项目名称:thumbor,代码行数:7,代码来源:test_pil.py


示例7: get_app

    def get_app(self):
        storage_path = '/tmp/thumbor-engines-test/'
        if exists(storage_path):
            rmtree(storage_path)

        self.timeout_handle = None
        cfg = Config(SECURITY_KEY='ACME-SEC', FILE_STORAGE_ROOT_PATH=storage_path)
        server_params = ServerParameters(None, None, None, None, None, None)

        cfg.DETECTORS = [
            'thumbor.detectors.face_detector',
            'thumbor.detectors.profile_detector',
            'thumbor.detectors.glasses_detector',
            'thumbor.detectors.feature_detector',
        ]

        conf_key = self._testMethodName.split('__')[1]
        conf = CONFS.get(conf_key, None)
        if conf:
            for key, value in conf.items():
                setattr(cfg, key, value)

        importer = Importer(cfg)
        importer.import_modules()
        ctx = Context(server_params, cfg, importer)
        application = ThumborServiceApp(ctx)

        return application
开发者ID:abhishekgodhani,项目名称:thumbor,代码行数:28,代码来源:engines_test.py


示例8: get_config

 def get_config(self):
     cfg = Config(SECURITY_KEY='ACME-SEC')
     cfg.LOADER = "thumbor.loaders.file_loader"
     cfg.FILE_LOADER_ROOT_PATH = self.loader_path
     cfg.STORAGE = "thumbor.storages.no_storage"
     cfg.AUTO_WEBP = True
     return cfg
开发者ID:scorphus,项目名称:thumbor,代码行数:7,代码来源:test_base_handler.py


示例9: test_with_aliased_aliases_with_default_values

 def test_with_aliased_aliases_with_default_values(self):
     Config.alias('STORAGE_ALIAS', 'STORAGE')
     Config.alias('STORAGE_ALIAS_ALIAS', 'STORAGE_ALIAS')
     cfg = Config()
     expect(cfg.STORAGE).to_equal(self.get_default_storage())
     expect(cfg.STORAGE_ALIAS).to_equal(self.get_default_storage())
     expect(cfg.STORAGE_ALIAS_ALIAS).to_equal(self.get_default_storage())
     expect(cfg.__class__.__module__).to_equal('derpconf.config')
开发者ID:RealGeeks,项目名称:thumbor,代码行数:8,代码来源:test_config.py


示例10: get_context

    def get_context(self):
        cfg = Config()
        cfg.HEALTHCHECK_ROUTE = '/'

        importer = Importer(cfg)
        importer.import_modules()

        return Context(None, cfg, importer)
开发者ID:okor,项目名称:thumbor,代码行数:8,代码来源:test_healthcheck.py


示例11: topic

            def topic(self):
                conf = Config(MONGO_STORAGE_SERVER_PORT=7777, STORES_CRYPTO_KEY_FOR_EACH_IMAGE=False)
                server = get_server('')
                storage = MongoStorage(Context(config=conf, server=server))
                storage.put(IMAGE_URL % 13, IMAGE_BYTES)

                conf.STORES_CRYPTO_KEY_FOR_EACH_IMAGE = True
                storage.put_crypto(IMAGE_URL % 13)
开发者ID:SONIFI,项目名称:thumbor,代码行数:8,代码来源:mongo_storage_vows.py


示例12: get_config

    def get_config(self):
        cfg = Config(SECURITY_KEY='ACME-SEC')

        cfg.COMMUNITY_EXTENSIONS = [
            'wikimedia_thumbor.handler.healthcheck'
        ]

        return cfg
开发者ID:wikimedia,项目名称:operations-debs-python-thumbor-wikimedia,代码行数:8,代码来源:test_healthcheck_handler.py


示例13: get_context

    def get_context(self):
        cfg = Config(
            SECURITY_KEY='ACME-SEC',
            ENGINE='thumbor.engines',
        )
        cfg.STORAGE = 'thumbor.storages.no_storage'

        return Context(config=cfg)
开发者ID:caeugusmao,项目名称:thumbor,代码行数:8,代码来源:test_base_engine.py


示例14: get_optimizer

    def get_optimizer(self):
        conf = Config()
        conf.STATSD_HOST = ''
        conf.JPEGTRAN_PATH = which('jpegtran')
        ctx = Context(config=conf)
        optimizer = Optimizer(ctx)

        return optimizer
开发者ID:Bladrak,项目名称:thumbor,代码行数:8,代码来源:test_jpegtran.py


示例15: topic

 def topic(self):
     conf = Config()
     conf.METRICS = 'tc_librato.metrics.librato_metrics'
     conf.LIBRATO_USER = 'test'
     conf.LIBRATO_TOKEN = 'test'
     conf.LIBRATO_NAME_PREFIX = 'test'
     imp = Importer(conf)
     imp.import_modules()
     return Context(None, conf, imp)
开发者ID:thumbor-community,项目名称:librato,代码行数:9,代码来源:metrics_vows.py


示例16: get_context

    def get_context(self):
        conf = Config()
        conf.STATSD_HOST = ''
        conf.FFMPEG_PATH = which('ffmpeg')
        ctx = Context(config=conf)
        ctx.request = RequestParameters()
        ctx.request.filters.append('gifv')

        return ctx
开发者ID:gi11es,项目名称:thumbor-debian,代码行数:9,代码来源:test_gifv.py


示例17: test_without_allowed_sources

    def test_without_allowed_sources(self):
        config = Config()
        config.ALLOWED_SOURCES = []
        ctx = Context(None, config, None)
        is_valid = loader.validate(ctx, 'https://www.google.com/logo.jpg')
        expect(is_valid).to_be_true()

        is_valid = loader.validate(ctx, 'http://www.google.com/logo.jpg')
        expect(is_valid).to_be_false()
开发者ID:Bladrak,项目名称:thumbor,代码行数:9,代码来源:test_strict_https_loader.py


示例18: topic

            def topic(self):
                url = self.get_url('/')
                loader.http_client = self._http_client

                config = Config()
                config.ALLOWED_SOURCES = ['s.glbimg.com']
                ctx = Context(None, config, None)

                return loader.load, ctx, url
开发者ID:xialisun,项目名称:thumbor,代码行数:9,代码来源:https_loader_vows.py


示例19: get_config

def get_config(config_path, use_environment=False):
    if use_environment:
        Config.allow_environment_variables()

    lookup_paths = [os.curdir,
                    expanduser('~'),
                    '/etc/',
                    dirname(__file__)]

    return Config.load(config_path, conf_name='thumbor.conf', lookup_paths=lookup_paths)
开发者ID:caeugusmao,项目名称:thumbor,代码行数:10,代码来源:server.py


示例20: get_context

    def get_context(self):
        cfg = Config(SECURITY_KEY='ACME-SEC')
        cfg.LOADER = "thumbor.loaders.file_loader"
        cfg.FILE_LOADER_ROOT_PATH = self.loader_path

        importer = Importer(cfg)
        importer.import_modules()
        server = ServerParameters(8889, 'localhost', 'thumbor.conf', None, 'info', None)
        server.security_key = 'ACME-SEC'
        return Context(server, cfg, importer)
开发者ID:kyeongchan,项目名称:thumbor,代码行数:10,代码来源:test_base_handler.py



注:本文中的thumbor.config.Config类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python context.Context类代码示例发布时间:2022-05-27
下一篇:
Python util.indent函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap