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

Python config.init_app函数代码示例

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

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



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

示例1: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='theory', paths=paths)

    config['routes.map'] = make_map()
    config['pylons.app_globals'] = app_globals.Globals()
    config['pylons.h'] = theory.lib.helpers

    config['pylons.strict_tmpl_context'] = False

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=paths['templates'],
        module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
        input_encoding='utf-8', output_encoding='utf-8',
        imports=['from webhelpers.html import escape'], default_filters=['escape'])
        
    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    config['wwwpath'] = '.'
开发者ID:drewp,项目名称:theory,代码行数:30,代码来源:environment.py


示例2: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='metahash', paths=paths)

    config['routes.map'] = make_map()
    config['pylons.app_globals'] = app_globals.Globals()
    config['pylons.h'] = metahash.lib.helpers

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=paths['templates'],
        error_handler=handle_mako_error,
        module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
        input_encoding='utf-8', default_filters=['escape'],
        imports=['from webhelpers.html import escape'])
开发者ID:chrisforbes,项目名称:metahash-backend,代码行数:25,代码来源:environment.py


示例3: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='fivecents', paths=paths)

    config['routes.map'] = make_map()
    config['pylons.g'] = app_globals.Globals()
    config['pylons.h'] = fivecents.lib.helpers

    # Jinja2 configuration
    config['pylons.g'].jinja2_env = Environment(
        loader=fivecents.lib.jinja2.PackageLoader('fivecents', 'templates', get_language=pylons_get_lang), 
        extensions=['jinja2.ext.i18n'])

    config['pylons.g'].jinja2_env.filters.update(fivecents.lib.jinja2.filters)

    # Jinja's unable to request c's attributes without strict_c
    config['pylons.strict_c'] = True

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    
    # Let this app locale is taken from environment (do not use default 'C' locale)
    setlocale(LC_ALL, '')

    check_config()
开发者ID:pawelniewie,项目名称:5groszy.pl,代码行数:35,代码来源:environment.py


示例4: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='mapclient', paths=paths)

    config['routes.map'] = make_map()
    config['pylons.app_globals'] = app_globals.Globals()
    config['pylons.h'] = mapclient.lib.helpers

    # Create the Jinja2 Environment
    config['pylons.app_globals'].jinja2_env = Environment(loader=ChoiceLoader(
            [FileSystemLoader(path) for path in paths['templates']]))
    # Jinja2's unable to request c's attributes without strict_c
    config['pylons.strict_c'] = True

    # Setup the SQLAlchemy database engine
    engine = engine_from_config(config, 'mapclient.sqlalchemy.')
    engine_ckan_data = engine_from_config(config, 'vectorstore.sqlalchemy.')
    init_model(engine, engine_ckan_data)
开发者ID:PublicaMundi,项目名称:MapClient,代码行数:28,代码来源:environment.py


示例5: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(
        root=root,
        controllers=os.path.join(root, "controllers"),
        static_files=os.path.join(root, "public"),
        templates=[os.path.join(root, "templates")],
    )

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package="fivecents", paths=paths)

    config["routes.map"] = make_map()
    config["pylons.g"] = app_globals.Globals()
    config["pylons.h"] = fivecents.lib.helpers

    # Jinja2 configuration
    config["pylons.g"].jinja_env = Environment(
        loader=PackageLoader("fivecents", "templates", get_language=pylons_get_lang), extensions=["jinja2.ext.i18n"]
    )

    config["pylons.g"].jinja_env.filters.update(fivecents.lib.jinja2.filters)

    # Jinja's unable to request c's attributes without strict_c
    config["pylons.strict_c"] = True
开发者ID:pawelniewie,项目名称:5groszy.pl,代码行数:29,代码来源:environment.py


示例6: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='fivecents',
                    template_engine='jinja', paths=paths)

    config.add_template_engine('jinja', '', {
        'jinja.package':            'fivecents',
        'jinja.package_path':       'templates',
        'jinja.use_memcache':       False,
        'jinja.cache_folder':       'data/templates',
        'jinja.auto_reload':        True,
        'jinja.extension':          'jinja',
    })

    config['routes.map'] = make_map()
    config['pylons.g'] = app_globals.Globals()
    config['pylons.h'] = fivecents.lib.helpers

    # Jinja's unable to request c's attributes without strict_c
    config['pylons.strict_c'] = True

    # Customize templating options via this variable
    tmpl_options = config['buffet.template_options']
开发者ID:pawelniewie,项目名称:5groszy.pl,代码行数:33,代码来源:environment.py


示例7: load_environment

def load_environment( global_conf, app_conf ):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname( os.path.dirname( os.path.abspath( __file__ ) ) )
    diracConfig = initDIRAC( root, global_conf[ 'debug' ] )
    paths = dict( root = root,
                  controllers = diracConfig[ 'controllers' ],
                  static_files = diracConfig[ 'public' ],
                  templates = diracConfig[ 'templates' ] )

    # Initialize config with the basic options
    config.init_app( global_conf, app_conf, package = 'dirac',
                    template_engine = 'mako', paths = paths )
    #Add dirac configs
    for k in diracConfig[ 'webConfig' ]:
      config[ k ] = diracConfig[ 'webConfig' ][ k ]


    config['routes.map'] = make_map()
    config['pylons.g'] = app_globals.Globals()
    config['pylons.h'] = dirac.lib.helpers

    # Customize templating options via this variable
    tmpl_options = config['buffet.template_options']
    config['version'] = diracConfig['portalVersion']
开发者ID:DIRACGrid,项目名称:DIRACWeb,代码行数:27,代码来源:environment.py


示例8: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='debshots', paths=paths)

    # Don't stumble upon undefined c variables in templates (restores Pylons 0.9.6 behavior)
    config['pylons.strict_c'] = False

    config['routes.map'] = make_map()
    config['pylons.app_globals'] = app_globals.Globals()
    config['pylons.h'] = debshots.lib.helpers

    # Allow access to c.* variables that are unset
    config['pylons.strict_tmpl_context'] = False

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=paths['templates'],
        error_handler=handle_mako_error,
        module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
        input_encoding='utf-8', default_filters=['escape'],
        imports=['from webhelpers.html import escape'])

    # Setup the SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.')
    init_model(engine)
开发者ID:rhlee-canonical,项目名称:ubuntushots,代码行数:35,代码来源:environment.py


示例9: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='classifier', paths=paths)

    config['routes.map'] = make_map()
    config['pylons.app_globals'] = app_globals.Globals()
    config['pylons.h'] = classifier.lib.helpers

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=paths['templates'],
        module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
        input_encoding='utf-8', output_encoding='utf-8',
        imports=['from webhelpers.html import escape'],
        default_filters=['escape'])
    
    # Setup SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.')
    init_model(engine)
开发者ID:cmci,项目名称:cecog,代码行数:29,代码来源:environment.py


示例10: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config`` object"""
    # Pylons paths
    root = os.path.dirname(os.path.abspath(__file__))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_external_paths=[os.path.join(root, 'public', 'external')],
                 static_development_paths=[os.path.join(root, 'public', 'development')],
                 static_release_paths=[os.path.join(root, 'public', 'release')],
                 static_viewer_paths=[os.path.realpath(os.path.join(root, '..', '..'))],
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='turbulenz_local', paths=paths)

    config['routes.map'] = make_map()
    config['pylons.app_globals'] = Globals()
    config['pylons.h'] = make_helpers(config)

    # Create the Jinja2 Environment
    config['pylons.app_globals'].jinja2_env = Environment(loader=FileSystemLoader(paths['templates']))

    # Jinja2's unable to request c's attributes without strict_c
    config['pylons.strict_c'] = True

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    config['pylons.response_options']['headers'] = {'Cache-Control': 'public, max-age=0',
                                                    'Pragma': 'no-cache'}
开发者ID:chenbk85,项目名称:turbulenz_local,代码行数:29,代码来源:wsgiapp.py


示例11: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='helloworld',
                    template_engine='mako', paths=paths)

    config['routes.map'] = make_map()
    config['pylons.g'] = app_globals.Globals()
    config['pylons.h'] = helloworld.lib.helpers

    # Customize templating options via this variable
    tmpl_options = config['buffet.template_options']

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    engine = engine_from_config(config, 'sqlalchemy.')
    init_model(engine)
开发者ID:tdyhacker,项目名称:pythonexploration,代码行数:26,代码来源:environment.py


示例12: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='forum',
                    template_engine='mako', paths=paths)

    config['routes.map'] = make_map()
    config['pylons.g'] = app_globals.Globals()
    config['pylons.h'] = forum.lib.helpers

    # Customize templating options via this variable
    tmpl_options = config['buffet.template_options']
    #tmpl_options['mako.output_encoding'] = 'utf-8'
    #tmpl_options['genshi.output_encoding'] = 'utf-8'

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    
    config.add_template_engine('genshi', 'forum.templates', {})
    #config['pylons.response_options']['charset'] = 'utf-8'
    #config['pylons.request_options']['charset'] = 'utf-8'
    
    reload(sys)
    sys.setdefaultencoding('utf-8')
开发者ID:Vincentyuan,项目名称:pforum,代码行数:33,代码来源:environment.py


示例13: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=[file_paths['theme_public'], file_paths['public_path']],
                 templates=[os.path.join(root, 'templates')],           # apparently pylons still wants this and as a list
                 default_theme=file_paths['base_theme'],
                 enabled_theme=file_paths['enabled_theme'])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='zookeepr', paths=paths)

    config['routes.map'] = make_map()
    config['pylons.app_globals'] = app_globals.Globals()
    config['pylons.h'] = zookeepr.lib.helpers

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=[paths['enabled_theme'], paths['default_theme']],
        error_handler=handle_mako_error,
        module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
        input_encoding='utf-8', default_filters=['escape'],
        imports=['from webhelpers.html import escape'])

    # Setup the SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.')
    init_model(engine)
开发者ID:CarlFK,项目名称:zookeepr,代码行数:31,代码来源:environment.py


示例14: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='yolanda',
                    template_engine='mako', paths=paths)

    config['routes.map'] = make_map()
    config['pylons.g'] = app_globals.Globals()
    config['pylons.h'] = yolanda.lib.helpers

    # Customize templating options via this variable
    tmpl_options = config['buffet.template_options']

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    
    config['pylons.response_options']['content_type'] = "application/xhtml+xml"
    # FIXME: this is generally wrong for other XML content

    model.metadata.bind = engine_from_config(config, 'sqlalchemy.')
    model.metadata.bind.echo = True

    # better safe than sorry - everything should be utf-8
    tmpl_options['mako.input_encoding'] = 'utf-8'
开发者ID:josch,项目名称:yolanda,代码行数:33,代码来源:environment.py


示例15: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='vault', paths=paths)

    config['routes.map'] = make_map()
    config['pylons.app_globals'] = app_globals.Globals()
    config['pylons.h'] = vault.lib.helpers

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=paths['templates'],
        error_handler=handle_mako_error,
        module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
        input_encoding='utf-8', default_filters=['escape'],
        imports=['from webhelpers.html import escape'])

    # Setup the SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.')
    init_model(engine)

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    config['root'] = root
    config['uploads.root'] = os.path.join(root, 'public')
    config['uploads.previews'] = os.path.join(config['uploads.root'], 'imgs', 'previews')
开发者ID:HyFrmn,项目名称:vault,代码行数:35,代码来源:environment.py


示例16: make_app

def make_app(global_conf, full_stack=True, **app_conf):
    # load Pylons environment
    root = os.path.dirname(os.path.abspath(__file__))
    paths = dict(
        templates=[os.path.join(root, 'templates')],
    )
    config.init_app(global_conf, app_conf, paths=paths)
    config['pylons.package'] = 'tests.contrib.pylons.app'
    config['pylons.app_globals'] = AppGlobals()

    # set Pylons routes
    config['routes.map'] = create_routes()

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=paths['templates'],
    )

    # define a default middleware stack
    app = PylonsApp()
    app = RoutesMiddleware(app, config['routes.map'])
    app = SessionMiddleware(app, config)
    app = CacheMiddleware(app, config)
    app = RegistryManager(app)
    return app
开发者ID:tebriel,项目名称:dd-trace-py,代码行数:25,代码来源:web.py


示例17: load_environment

def load_environment(global_conf, app_conf):
    """\
    Configure the Pylons environment via the ``pylons.config`` object
    """

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(
        global_conf,
        app_conf,
        package='openspending.ui',
        paths=paths)

    config['routes.map'] = routing.make_map()
    config['pylons.app_globals'] = app_globals.Globals()
    config['pylons.h'] = helpers

    # set log level in markdown
    markdown.logger.setLevel(logging.WARN)

    # SQLAlchemy
    engine = engine_from_config(config, 'openspending.db.')
    engine = construct_engine(engine)
    init_model(engine)

    # Configure Solr
    import openspending.lib.solr_util as solr
    solr.configure(config)
开发者ID:ToroidalATLAS,项目名称:openspending,代码行数:34,代码来源:environment.py


示例18: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='fivecents', paths=paths)

    config['routes.map'] = make_map()
    config['pylons.g'] = app_globals.Globals()
    config['pylons.h'] = fivecents.lib.helpers

    # Jinja2 configuration
    config['pylons.g'].jinja_env = Environment(loader=PackageLoader('fivecents', 'templates'), extensions=['jinja2.ext.i18n'])

    # Jinja's unable to request c's attributes without strict_c
    config['pylons.strict_c'] = True

    init_model(engine_from_config(config, 'sqlalchemy.'))
开发者ID:pawelniewie,项目名称:5groszy.pl,代码行数:25,代码来源:environment.py


示例19: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(
        root=root,
        controllers=os.path.join(root, "controllers"),
        static_files=os.path.join(root, "public"),
        templates=[os.path.join(root, "templates")],
    )

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package="dabo", paths=paths)

    config["routes.map"] = make_map()
    config["pylons.app_globals"] = app_globals.Globals()
    config["pylons.h"] = dabo.lib.helpers

    # Create the Mako TemplateLookup, with the default auto-escaping
    config["pylons.app_globals"].mako_lookup = TemplateLookup(
        directories=paths["templates"],
        error_handler=handle_mako_error,
        module_directory=os.path.join(app_conf["cache_dir"], "templates"),
        input_encoding="utf-8",
        default_filters=["escape"],
        imports=["from webhelpers.html import escape"],
    )
开发者ID:EdLeafe,项目名称:dabo-site,代码行数:29,代码来源:environment.py


示例20: load_api_environment

def load_api_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='annikki', paths=paths)

    config['routes.map'] = make_api_map()
    config['pylons.app_globals'] = app_globals.Globals()
    config['pylons.h'] = annikki.lib.helpers

    # Create the Genshi TemplateLoader
    config['pylons.app_globals'].genshi_loader = TemplateLoader(
        paths['templates'], auto_reload=True)

    # Setup the SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.', echo = True)
    init_model(engine)
开发者ID:kmlawson,项目名称:annikki,代码行数:25,代码来源:environment.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python config.update函数代码示例发布时间:2022-05-25
下一篇:
Python config.get函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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