本文整理汇总了Python中pyramid.config.Configurator.override_asset方法的典型用法代码示例。如果您正苦于以下问题:Python Configurator.override_asset方法的具体用法?Python Configurator.override_asset怎么用?Python Configurator.override_asset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.config.Configurator
的用法示例。
在下文中一共展示了Configurator.override_asset方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import override_asset [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
session_factory = UnencryptedCookieSessionFactoryConfig('itsaseekreet')
config = Configurator(settings=settings, session_factory=session_factory)
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
config.registry.registerUtility(DBSession, IDBSession)
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('favicon', '/favicon.ico')
config.add_view('pzatrick_dot_com.views.favicon_view', route_name='favicon')
#config.include('hiero', route_prefix='/blog')
config.include('horus', route_prefix='auth')
config.include('hiero', route_prefix='blog')
config.include('pzatrick_dot_com.routes')
config.override_asset(
to_override='hiero:templates/blog_index.mako',
override_with='pzatrick_dot_com:templates/blog_index.mako'
)
config.override_asset(
to_override='hiero:templates/entry_detail.mako',
override_with='pzatrick_dot_com:templates/entry_detail.mako'
)
config.include("pzatrick_dot_com.assets")
config.scan()
return config.make_wsgi_app()
示例2: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import override_asset [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
authentication_policy = AuthTktAuthenticationPolicy('seekrit',
callback=groupfinder)
authorization_policy = ACLAuthorizationPolicy()
config = Configurator(
settings = settings
, authentication_policy = authentication_policy
, authorization_policy=authorization_policy
)
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
config.registry.registerUtility(DBSession, IDBSession)
config.override_asset(
to_override='hiero:templates/blog_index.mako',
override_with='sontek:templates/blog_index.mako'
)
config.override_asset(
to_override='hiero:templates/entry_detail.mako',
override_with='sontek:templates/entry_detail.mako'
)
config.include('sontek.routes')
config.scan()
return config.make_wsgi_app()
示例3: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import override_asset [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
authentication_policy = AuthTktAuthenticationPolicy('seekrit',
callback=groupfinder)
authorization_policy = ACLAuthorizationPolicy()
config = Configurator(
settings = settings
, authentication_policy = authentication_policy
, authorization_policy=authorization_policy
)
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Base.metadata.bind = engine
config.registry.registerUtility(DBSession, IDBSession)
config.override_asset(
to_override='hiero:templates/blog_index.mako',
override_with='hhblog:templates/blog_index.mako'
)
config.override_asset(
to_override='hiero:templates/entry_detail.mako',
override_with='hhblog:templates/entry_detail.mako'
)
config.add_route('index', 'lkjalsdkj')
config.add_static_view('static', 'static', cache_max_age=3600)
config.scan()
config.include('horus', route_prefix='auth')
config.include('hiero')
config.scan()
return config.make_wsgi_app()
示例4: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import override_asset [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
config.add_translation_dirs('unicorecmsmnm:locale')
config.include('cms')
config.add_static_view('static', 'static', cache_max_age=3600)
config.scan()
config.override_asset('cms:templates/', 'unicorecmsmnm:templates/')
return config.make_wsgi_app()
示例5: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import override_asset [as 别名]
def main(global_config, **settings):
cp = ConfigParser()
cp.readfp(pkg_resources.resource_stream('springboard', 'defaults.ini'))
defaults = dict(cp.items('springboard:pyramid'))
defaults.update(settings)
config = Configurator(settings=defaults)
config.include('springboard.config')
config.override_asset(
to_override='springboard:templates/',
override_with='{{cookiecutter.app_name}}:templates/')
config.add_static_view(
'static', '{{cookiecutter.app_name}}:static', cache_max_age=3600)
return config.make_wsgi_app()
示例6: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import override_asset [as 别名]
def main(global_config, **settings):
"""
Generate WSGI application
"""
config = Configurator(settings=settings, route_prefix='/api/')
initialize_dbsession(settings, prefix='sqlalchemy.')
config.set_authorization_policy(ACLAuthorizationPolicy())
machine_id = read_machine_id()
config.set_authentication_policy(AuthTktAuthenticationPolicy(machine_id + '-auth'))
config.set_session_factory(SignedCookieSessionFactory(machine_id + '-session'))
config.include('pyramid_jinja2')
config.include('pyramid_mailer')
config.include('pyramid_mako')
config.include('pluserable')
for template in ['login', 'register', 'forgot_password', 'reset_password', 'edit_profile']:
config.override_asset(
to_override='pluserable:templates/%s.mako' % template,
override_with='tutorweb_quizdb:templates/auth/%s.mako' % template
)
config.setup_pluserable(os.path.join(global_config['here'], 'kerno.ini'))
smileycoin.configure(settings, prefix='smileycoin.')
config.include('tutorweb_quizdb.coin')
config.include('tutorweb_quizdb.exceptions')
config.include('tutorweb_quizdb.logerror')
config.include('tutorweb_quizdb.material')
config.include('tutorweb_quizdb.subscriptions')
config.include('tutorweb_quizdb.stage')
config.include('tutorweb_quizdb.student')
config.include('tutorweb_quizdb.rst')
json_renderer = config.registry.getUtility(IRendererFactory, name="json")
json_renderer.add_adapter(datetime.datetime, lambda obj, request: obj.isoformat())
json_renderer.add_adapter(Ltree, lambda obj, request: str(obj))
config.add_view(index, route_name='index', renderer='json')
config.add_route('index', '')
return config.make_wsgi_app()
示例7: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import override_asset [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application."""
engine = engine_from_config(settings, 'sqlalchemy.')
session_factory = session_factory_from_settings(settings)
DBSession.configure(bind=engine)
config = Configurator(settings=settings, session_factory=session_factory)
if not config.registry.queryUtility(IAuthorizationPolicy):
authz_policy = ACLAuthorizationPolicy()
config.set_authorization_policy(authz_policy)
if not config.registry.queryUtility(IAuthenticationPolicy):
authn_policy = AuthTktAuthenticationPolicy(
settings.get('jobinator.auth_secret'),
callback=groupfinder)
config.set_authentication_policy(authn_policy)
# Include horus
from hem.interfaces import IDBSession
from horus.interfaces import IHorusUserClass, IHorusActivationClass
# Tell horus which SQLAlchemy session to use:
config.registry.registerUtility(DBSession, IDBSession)
config.registry.registerUtility(User, IHorusUserClass)
config.registry.registerUtility(Activation, IHorusActivationClass)
config.include('horus', route_prefix='auth')
config.include('pyramid_rpc.jsonrpc')
#config.include('hiero', route_prefix='hiero')
config.include('pyramid_mailer')
config.add_static_view('static', 'static', cache_max_age=3600)
config.include('jobinator.routes')
config.override_asset(to_override='horus:templates/',
override_with='jobinator:templates/horus/')
config.scan()
initialize_sql(engine)
return config.make_wsgi_app()