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


Python Configurator.ptah_populate方法代码示例

本文整理汇总了Python中pyramid.config.Configurator.ptah_populate方法的典型用法代码示例。如果您正苦于以下问题:Python Configurator.ptah_populate方法的具体用法?Python Configurator.ptah_populate怎么用?Python Configurator.ptah_populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyramid.config.Configurator的用法示例。


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

示例1: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import ptah_populate [as 别名]
def main(global_config, **settings):
    """ This is your application startup.
    """
    config = Configurator(root_factory=APP_FACTORY, settings=settings)

    # static assets
    config.add_static_view('ptah_minicms', 'ptah_minicms:static')

    config.scan()

    # init sqlalchemy engine
    config.ptah_init_sql()

    # init ptah settings
    config.ptah_init_settings()

    # enable rest api
    config.ptah_init_rest()

    # enable ptah manage
    config.ptah_init_manage()

    # populate database
    config.ptah_populate()

    return config.make_wsgi_app()
开发者ID:cguardia,项目名称:examples,代码行数:28,代码来源:app.py

示例2: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import ptah_populate [as 别名]
def main(global_config, **settings):
    """ This is your application startup.
    """
    config = Configurator(settings=settings)
    config.include('pyramid_mailer')
    config.include('ptahcrowd')
    config.include('ptahcms')
    config.include('devapp')

    # init ptah settings
    config.ptah_init_settings()

    # init ptah sqlalchemy
    config.ptah_init_sql()

    # enable rest api
    config.ptah_init_rest()

    # enable ptah manage
    config.ptah_init_manage()

    # enable ptah manage
    config.ptah_populate()

    # set ptah mailer
    from pyramid_mailer.interfaces import IMailer
    mailer = config.registry.queryUtility(IMailer)
    config.ptah_init_mailer(mailer.direct_delivery)

    # We are not in a web request; we need to manually commit.
    transaction.commit()

    return config.make_wsgi_app()
开发者ID:ptahproject,项目名称:devel,代码行数:35,代码来源:__init__.py

示例3: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import ptah_populate [as 别名]
def main(global_config, **settings):
    """ Function which returns a configured Pyramid/Ptah WSIG Application """

    # Construct a db connection URL from 30Loops environment variables
    # pattern is postgresql+psycopg2://scott:[email protected]/mydatabase
    env = None
    try:
        f = open('/app/conf/environment.json')
        env = json.load(f)
        db_user = env["DB_USER"]
        db_name = env["DB_NAME"]
        db_host = env["DB_HOST"]
        db_pass = env["DB_PASSWORD"]
        db_url = "postgresql+psycopg2://"+db_user+":"+db_pass+"@"+db_host+"/"+dbname
        # Override the SQLAlchemy url from settings.ini
        settings['sqlalchemy.url']=db_url
    except:
        pass

    # Info: This is how Pyramid is configured.
    config = Configurator(settings=settings,
                          session_factory = session_factory,
                          authentication_policy = auth_policy)

    # Info: This includes packages which have Pyramid configuration
    config.include('ptah')
    config.commit()

    # Refer: Ptah: _Initialization_
    config.ptah_init_settings()

    # Refer: Ptah: _Initialization_
    config.ptah_init_sql()

    # enable ptah management
    config.ptah_init_manage(managers=('*',))

    # populate database
    config.ptah_populate()

    # Refer: Pyramid's _URL Dispatch_
    config.add_route('home', '/')

    # static assets
    config.add_static_view('_urbsly', 'urbsly:static')

    # Refer: Pyramid's _Configuration Decorations and Code Scanning_
    config.scan()

    return config.make_wsgi_app()
开发者ID:Urbsly,项目名称:30loops-ptah,代码行数:52,代码来源:app.py

示例4: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import ptah_populate [as 别名]
def main(global_config, **settings):
    """ Function which returns a configured Pyramid/Ptah WSIG Application """

    # Info: This is how Pyramid is configured.

    durl = os.environ.get("DATABASE_URL") #heroku

    if durl:
        settings['sqlalchemy.url']=durl
    else:
        logger.info('Did not find DATABASE_URL! You must issue, '
                    '$ heroku addons:add shared-database')

    config = Configurator(settings=settings,
                          session_factory = session_factory,
                          authentication_policy = auth_policy)

    # Info: This includes packages which have Pyramid configuration
    config.include('ptah')

    # Refer: Ptah: _Initialization_
    config.ptah_init_settings()

    # Refer: Ptah: _Initialization_
    config.ptah_init_sql()

    # enable ptah management
    config.ptah_init_manage(managers=('admin',))

    # populate database
    config.ptah_populate()

    # Refer: Pyramid's _URL Dispatch_
    config.add_route('home', '/')
    config.add_route('home2', '/home2')

    # static assets
    config.add_static_view('_herokuapp', 'herokuapp:static')

    # js protocols
    config.include('herokuapp.protocols')

    # add role
    Admin = ptah.Role('admin', 'Admin')
    Manager = ptah.Role('manager', 'Manager')

    # Refer: Pyramid's _Configuration Decorations and Code Scanning_
    config.scan()

    return config.make_wsgi_app()
开发者ID:ptahproject,项目名称:heroku-ptah,代码行数:52,代码来源:app.py

示例5: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import ptah_populate [as 别名]
def main(global_config, **settings):
    """ Function which returns a configured Pyramid/Ptah WSIG Application """

    # Info: This is how Pyramid is configured.

    # Originally for Heroku, needs to be modified for 30Loops
    #durl = os.environ.get("DATABASE_URL")
    #if durl:
    #    settings['sqlalchemy.url']=durl

    config = Configurator(settings=settings,
                          session_factory = session_factory,
                          authentication_policy = auth_policy)

    # Info: This includes packages which have Pyramid configuration
    config.include('ptah')
    config.commit()

    # Refer: Ptah: _Initialization_
    config.ptah_init_settings()

    # Refer: Ptah: _Initialization_
    config.ptah_init_sql()

    # enable ptah management
    config.ptah_init_manage(managers=('*',))

    # populate database
    config.ptah_populate()

    # Refer: Pyramid's _URL Dispatch_
    config.add_route('home', '/')

    # static assets
    config.add_static_view('_urbsly', 'urbsly:static')

    # Refer: Pyramid's _Configuration Decorations and Code Scanning_
    config.scan()

    return config.make_wsgi_app()
开发者ID:bastichelaar,项目名称:30loops-ptah,代码行数:42,代码来源:app.py

示例6: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import ptah_populate [as 别名]
def main(global_config, **settings):
    """ This is your application startup."""

    config = Configurator(settings=settings,
                          session_factory = session_factory)

    config.ptah_init_settings()
    config.ptah_init_sql()
    config.ptah_init_manage(managers = ['*'])
    config.ptah_populate()

    # enable jca
    config.register_jca_sm()

    # internal chat
    config.register_jca_component(
        'chat', 'ptah_chat:jca/', protocol = ChatProtocol)

    # we love them routes
    config.add_route('root', '/')

    config.scan()
    return config.make_wsgi_app()
开发者ID:cguardia,项目名称:examples,代码行数:25,代码来源:app.py

示例7: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import ptah_populate [as 别名]
def main(global_config, **settings):
    """ This is your application startup.
    """
    config = Configurator(root_factory=APP_FACTORY, settings=settings)

    # mustache templates
    config.add_mustache_bundle('ptah_ws', 'ptah_ws:jcatemplates/')
    
    # jca module
    config.register_amd_module('settings', 'ptah_ws:static/settings.js')

    # static assets
    config.add_static_view('ptah_ws', 'ptah_ws:static')
    config.scan()

    # init sqlalchemy engine
    config.ptah_init_sql()

    # init ptah settings
    config.ptah_init_settings()

    # enable rest api
    config.ptah_init_rest()

    # enable ptah manage
    config.ptah_init_manage()

    # populate database
    config.ptah_populate()

    # init sqlalchemy session
    import ptah_ws
    engine = sa.engine_from_config(settings, 'sqlalchemy.')
    ptah_ws._Session = sa.orm.sessionmaker(bind=engine)

    return config.make_wsgi_app()
开发者ID:cguardia,项目名称:examples,代码行数:38,代码来源:app.py

示例8: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import ptah_populate [as 别名]
def main(global_config, **settings):
    """ This is your application startup.
    """

    # mount application to '/' location wit custom ApplicationRoot
    factory = ptah.cms.ApplicationFactory(
        PloudApplicationRoot,
        '/', 'root', 'Ptah CMS', ApplicationPolicy, default_root=True)

    config = Configurator(root_factory=factory, settings=settings)
    config.scan('ploud.themegallery')
    config.scan('ploud.frontend')
    config.scan('ploud.utils')

    # init sqlalchemy
    config.ptah_init_sql()

    # init ptah settings
    config.ptah_init_settings()

    # enable rest api
    config.ptah_init_rest()

    # enable ptah manage
    config.ptah_init_manage()

    # populate db
    config.ptah_populate()

    # frontend routes
    config.add_route(
        'login', '/sso-login/{site}/', use_global_views=True)

    config.add_route(
        'frontend-membership', '/membership.html', use_global_views=True)
    config.add_route(
        'frontend-membership1', '/membership-free.html', use_global_views=True)
    config.add_route(
        'frontend-membership2', '/membership-1.html', use_global_views=True)
    config.add_route(
        'frontend-membership3', '/membership-2.html', use_global_views=True)

    config.add_route(
        'dactions-vtransfer', '/actions.html/validateTransfer',
        use_global_views=True)
    config.add_route(
        'dactions-transfer', '/actions.html/transfer', use_global_views=True)
    config.add_route(
        'dactions-remove', '/actions.html/remove', use_global_views=True)
    config.add_route(
        'dactions-login', '/actions.html/login', use_global_views=True)
    config.add_route(
        'dashboard', '/dashboard.html', use_global_views=True)

    config.add_route(
        'frontend-login', '/login.html', use_global_views=True)
    config.add_route(
        'frontend-login-val', '/login.html/validate', use_global_views=True)
    config.add_route(
        'frontend-logout', '/logout.html', use_global_views=True)
    config.add_route(
        'frontend-resetpw', '/reset-password.html', use_global_views=True)
    config.add_route(
        'frontend-rpw-v','/reset-password.html/validate', use_global_views=True)
    config.add_route(
        'frontend-changepw', '/change-password.html', use_global_views=True)

    config.add_route(
        'frontend-home', '/index.html', use_global_views=True)
    config.add_route(
        'frontend-favicon', '/favicon.ico')
    config.add_route(
        'frontend-robots', '/robots.txt')
    config.add_route(
        'frontend-policy', '/privacy-policy.html', use_global_views=True)
    config.add_route(
        'frontend-toc', '/terms-of-service.html', use_global_views=True)
    config.add_route(
        'frontend-disabled', '/disabled.html', use_global_views=True)
    config.add_route(
        'frontend-404', '/404.html', use_global_views=True)
    config.add_route(
        'frontend-themes', '/themes', use_global_views=True)

    config.add_route(
        'signup-validate', '/signup/validate', use_global_views=True)
    config.add_route(
        'validate', '/validate', use_global_views=True)

    config.add_route(
        'daction-changehostname', '/changehostname.html', use_global_views=True)

    config.add_static_view('_ploud', 'ploud.frontend:assets')

    # theme gallery
    themeGalleryFactory = ptah.cms.ApplicationFactory(
        ThemeGallery, '/themes/', 'themes', 'Theme gallery',
        ThemeGalleryPolicy, config=config, parent_factory=factory)

    config.add_route(
#.........这里部分代码省略.........
开发者ID:enfold,项目名称:ploud.frontend,代码行数:103,代码来源:app.py


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