当前位置: 首页>>代码示例>>Python>>正文


Python paster.bootstrap函数代码示例

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


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

示例1: setup_app_from_commandline

 def setup_app_from_commandline(self, argv):
     if len(argv) < 2:
         print >> sys.stderr, 'No configuration file specified.'
         sys.exit(1)
     bootstrap(argv[1])
     self.app = default_app
     return argv[:1] + argv[2:]
开发者ID:breakthroughfuel,项目名称:pyramid_celery,代码行数:7,代码来源:celery.py

示例2: main

def main():
    if len(sys.argv) != 2:
        usage()

    bootstrap(sys.argv[1])

    Base.metadata.create_all()
开发者ID:ValentinVoigt,项目名称:tv.hadiko.de,代码行数:7,代码来源:create_tables.py

示例3: main

def main(args=None):
        """The main routine."""
        if args is None:
                args = sys.argv[1:]

        parser = argparse.ArgumentParser(description="Kinto commands")
        subparsers = parser.add_subparsers(title='subcommands',
                                           description='valid subcommands',
                                           help='init/start/migrate')

        parser_init = subparsers.add_parser('init')
        parser_init.set_defaults(which='init')
        parser_init.add_argument('--config_file', required=False,
                                 help='Config file may be passed as argument')

        parser_migrate = subparsers.add_parser('migrate')
        parser_migrate.set_defaults(which='migrate')

        parser_start = subparsers.add_parser('start')
        parser_start.set_defaults(which='start')

        args = vars(parser.parse_args())

        if args['which'] == 'init':
                if(args['config_file'] is None):
                    env = bootstrap('config/kinto.ini')
                else:
                    config_file = format(args['config_file'])
                    env = bootstrap(config_file)
        elif args['which'] == 'migrate':
                env = bootstrap('config/kinto.ini')
                cliquet.init_schema(env)
        elif args['which'] == 'start':
                pserve_argv = ['pserve', 'config/kinto.ini', '--reload']
                pserve.main(pserve_argv)
开发者ID:s-utsch,项目名称:kinto,代码行数:35,代码来源:__main__.py

示例4: quick_test

def quick_test(options):
    bootstrap(production=False)
    
    from runway.core.system.jobs.prune_logs import PruneLogsJob
    j = PruneLogsJob()
    j.perform_job(None)
    
    return ""
开发者ID:Teifion,项目名称:runway,代码行数:8,代码来源:cli.py

示例5: take_action

    def take_action(self, parsed_args):
        config = parsed_args.config
        bootstrap(config)

        create_blog(raw_input)

        import transaction
        transaction.commit()
开发者ID:aodag,项目名称:clarith,代码行数:8,代码来源:commands.py

示例6: init_db

def init_db(args):
    """Create database tables and elasticsearch indices."""
    # Force model creation using the MODEL_CREATE_ALL env var
    os.environ['MODEL_CREATE_ALL'] = 'True'

    # Start the application, triggering model creation
    paster.setup_logging(args.config_uri)
    paster.bootstrap(args.config_uri)
开发者ID:stuk88,项目名称:h,代码行数:8,代码来源:script.py

示例7: main

def main():
    if len(sys.argv) != 2:
        usage()

    config_uri = sys.argv[1]
    bootstrap(config_uri)

    Base.metadata.create_all()
开发者ID:ValentinVoigt,项目名称:ParticleDB,代码行数:8,代码来源:initializedb.py

示例8: main

def main(argv=sys.argv):  # pragma: no cover
    if len(argv) < 2:
        usage(argv)

    config_uri = argv[1]
    bootstrap(config_uri)
    setup_logging(config_uri)

    processor()
开发者ID:Connexions,项目名称:cnx-publishing,代码行数:9,代码来源:channel_processing.py

示例9: bootstrap

def bootstrap(args):
    """
    Bootstrap the application from the given arguments.

    Returns a bootstrapped request object.
    """
    paster.setup_logging(args.config_uri)
    request = Request.blank('/', base_url=args.base)
    paster.bootstrap(args.config_uri, request=request)
    return request
开发者ID:hylhero,项目名称:h,代码行数:10,代码来源:script.py

示例10: __init__

    def __init__(self, options):
        self.options = options
        self.imported = set()
        self.layers = []

        settings = {}
        with open(".build/config.yaml") as f:
            settings = yaml.load(f)

        self.languages = settings["available_locale_names"]

        # must be done only once we have loaded the project config
        from c2cgeoportal.models import DBSession, Interface, Theme, Role

        self.session = DBSession()

        self._ = {}
        self.metadata_service_url = \
            'http://shop.geoportail.lu/Portail/inspire/webservices/getMD.jsp'
        registry = bootstrap(self.options.app_config)['registry']
        request = bootstrap(self.options.app_config)['request']

        self.es_layer_index = get_index(request) + '_layers'
        self.tdirs = registry.queryUtility(ITranslationDirectories, default=[])
        self.tsf = TranslationStringFactory('geoportailv3-client')

        self.interfaces = self.session.query(Interface).filter(
            Interface.name.in_(options.interfaces)
        ).all()

        self.public_theme = {}
        self.public_group = {}
        for interface in self.interfaces:
            self.public_theme[interface.id] = []
            self.public_group[interface.id] = []

        for theme in self.session.query(Theme).filter_by(public=True).all():
            self._add_theme(theme)

        for role in self.session.query(Role).all():
            for theme in self.session.query(Theme).all():
                self._add_theme(theme, role)

        ensure_index(
            get_elasticsearch(request),
            self.es_layer_index,
            options.recreate_index
        )
        try:
            helpers.bulk(actions=self.layers,
                         client=get_elasticsearch(request),
                         raise_on_error=True)
        except (BulkIndexError, ConnectionTimeout) as e:
            statuslog("\n %s" % e)
开发者ID:geoportallux,项目名称:geoportailv3-gisgr,代码行数:54,代码来源:layers2es.py

示例11: take_action

    def take_action(self, parsed_args):
        from pyramid.paster import bootstrap
        from urakata.models import Scaffold, Session, Base
        bootstrap(parsed_args.config)

        # suppress logging
        Base.metadata.bind.echo = False

        header = [("name", "version", "repository", "utime")]
        row = [(s.name, s.version, s.repository.name, s.utime) for s in Session.query(Scaffold)]
        return header + [row]
开发者ID:podhmo,项目名称:urakata,代码行数:11,代码来源:list.py

示例12: main

def main():
    if len(sys.argv) != 2:
        usage()

    bootstrap(sys.argv[1])

    if shutil.which('convert') is None:
        print('Error: ImageMagick not found ("convert" is not in $PATH)')
        print('Try: sudo apt-get install imagemagick')
        sys.exit(2)

    create_logos()
开发者ID:ValentinVoigt,项目名称:tv.hadiko.de,代码行数:12,代码来源:create_logos.py

示例13: sql

def sql(options):
    bootstrap(production=False)
    
    results = cli_f.sql(*options.vals)
    
    for i, query in enumerate(results):
        print("")
        print(options.vals[i])
        if query.returns_rows:
            for row in query:
                print(row)
        print("")
    return ""
开发者ID:Teifion,项目名称:runway,代码行数:13,代码来源:cli.py

示例14: main

def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    os.environ['PYJASPER_SERVLET_URL'] = settings['jasper_url'] 
    bootstrap(config_uri)
    engine = engine_from_config(settings, 'sqlalchemy.')
    other_engine = engine_from_config(settings, 'othersql.')
    Base.metadata.bind = engine
    OtherBase.metadata.bind = other_engine
    from ..models.esppt_models import (
        esNopModel,
        esRegModel,
        spptModel,
        )
    from ..views.es_reports import GenerateSppt
    DBSession.configure(bind=engine)
    q = DBSession.query(esNopModel, esRegModel).filter(
            esNopModel.es_reg_id == esRegModel.id)
    q = q.filter(esNopModel.email_sent == 0)
    for r_nop, r_reg in q:
        nop = get_nop(r_nop)
        q = spptModel.get_by_nop_thn(nop, r_nop.tahun)
        sppt = q.first()
        if not sppt:
            continue
        nilai = thousand(sppt.pbb_yg_harus_dibayar_sppt)
        g = GenerateSppt(nop, r_nop.tahun, r_reg.kode) 
        #USER_ID) updated menggunakan password dari user yang ada di reg.kode aagusti
        sppt_file = g.sppt_file
        e_filename = os.path.split(sppt_file)[-1]
        f = open(sppt_file)
        content = f.read()
        f.close()
        e_content = base64.encodestring(content)
        e_subject = EMAIL_SUBJECT.format(nop=nop, tahun=r_nop.tahun)
        e_body = EMAIL_BODY.format(nama_wp=sppt.nm_wp_sppt, nop=nop,
                    tahun=r_nop.tahun, nilai=nilai)
        files = [(e_filename, e_content)]
        print('To: {name} <{email}>'.format(name=sppt.nm_wp_sppt,
                email=r_reg.email))
        print('Subject: {s}'.format(s=e_subject))
        print('Body: {s}'.format(s=e_body))
        print('File: {s}'.format(s=e_filename))
        r_nop.email_sent = 1
        flush(r_nop)
        send(r_reg.email, sppt.nm_wp_sppt, e_subject, e_body, files,
                settings['email_pengirim'])
    transaction.commit()
开发者ID:aagusti,项目名称:e-sppt,代码行数:51,代码来源:send_email.py

示例15: main

def main(argv=sys.argv):
    if len(argv) < 2:
        usage(argv)
    config_uri = argv[1]
    bootstrap(config_uri)

    email = input('Input Email:')
    password = getpass.getpass('Input Password:')

    user = User(email=email)
    set_password(user, password)

    with transaction.manager:
        DBSession.add(user)
开发者ID:hirokiky,项目名称:questy,代码行数:14,代码来源:createuser.py


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