本文整理汇总了Python中pyramid.config.Configurator.add_fanstatic_resources方法的典型用法代码示例。如果您正苦于以下问题:Python Configurator.add_fanstatic_resources方法的具体用法?Python Configurator.add_fanstatic_resources怎么用?Python Configurator.add_fanstatic_resources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.config.Configurator
的用法示例。
在下文中一共展示了Configurator.add_fanstatic_resources方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import add_fanstatic_resources [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings, autocommit=True)
get_current_registry().settings = settings
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('submitLogin', '/home/submit')
config.add_route('signup', '/signup')
config.add_route('submitSignup', '/signup/submit')
config.add_view_predicate('logged', LoggedPredicate)
for include in ['pyramid_chameleon', \
'pyramid_fanstatic', \
'pyramid_mailer', \
'pyramid_beaker', \
'rebecca.fanstatic', \
]:
config.include(include)
config.add_fanstatic_resources(['js.bootstrap.bootstrap',
'js.bootstrap.bootstrap_theme',
'css.fontawesome.fontawesome',
], r'.*\.pt')
config.scan()
return config.make_wsgi_app()
示例2: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import add_fanstatic_resources [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
sessionFactory = session_factory_from_settings(settings)
set_cache_regions_from_settings(settings)
config = Configurator(settings=settings)
config.include('pyramid_fanstatic')
config.include('pyramid_beaker')
config.include('pyramid_rawes')
config.include('rebecca.fanstatic')
config.set_session_factory(sessionFactory)
settings['ES'] = config.get_rawes()
get_current_registry().settings = settings
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('addContent', '/addContent')
config.add_route('content', '/content/{imgID}')
config.add_route('image', '/image/{imgID}')
# print settings['resources'].split(',')
# print [resource.strip() for resource in settings['resources'].split(',')]
config.add_fanstatic_resources([resource.strip() for resource in settings['resources'].split(',')], r'.*\.pt')
config.scan()
return config.make_wsgi_app()
示例3: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import add_fanstatic_resources [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
sessionFactory = session_factory_from_settings(settings)
set_cache_regions_from_settings(settings)
config = Configurator(settings=settings)
config.set_session_factory(sessionFactory)
get_current_registry().settings = settings
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('addContent', '/add')
config.add_route('oneContent', '/{idContent}')
config.add_route('oneContentRaw', '/{idContent}/raw')
config.add_route('update', '/{idContent}/update')
config.add_route('edit', '/{idContent}/edit')
config.add_route('deleteConfirm', '/{idContent}/deleteConfirm')
config.add_route('delete', '/{idContent}/delete')
config.add_route('rss2', '/feeds/rss2')
config.add_fanstatic_resources([resource.strip() for resource in settings['resources'].split(',')]
, r'.*\.pt')
config.scan()
return config.make_wsgi_app()
示例4: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import add_fanstatic_resources [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
config.include('pyramid_chameleon')
config.include('pyramid_fanstatic')
config.include('rebecca.fanstatic')
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('add', '/add')
config.add_fanstatic_resources(['js.bootstrap.bootstrap',
'js.bootstrap.bootstrap_theme',
'css.fontawesome.fontawesome',
], r'.*\.pt')
config.scan()
return config.make_wsgi_app()
示例5: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import add_fanstatic_resources [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
session_factory = UnencryptedCookieSessionFactoryConfig(
settings['session.secret']
)
authn_policy = SessionAuthenticationPolicy()
authz_policy = ACLAuthorizationPolicy()
config = Configurator(
settings=settings,
root_factory=RootFactory,
authentication_policy=authn_policy,
authorization_policy=authz_policy,
session_factory=session_factory
)
for include in ['pyramid_fanstatic',
'pyramid_chameleon',
'rebecca.fanstatic', ]:
config.include(include)
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('login_submit', '/login_submit')
config.add_route('logout', '/logout')
config.add_route('crays', '/crays')
config.add_route('switch_on', '/cray/{manager}/{blade}')
config.scan()
config.add_fanstatic_resources(['js.bootstrap.bootstrap',
'js.bootstrap.bootstrap_theme',
'css.fontawesome.fontawesome',
], r'.*\.pt')
return config.make_wsgi_app()
示例6: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import add_fanstatic_resources [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
sessionFactory = session_factory_from_settings(settings)
set_cache_regions_from_settings(settings)
config = Configurator(settings=settings)
config.set_session_factory(sessionFactory)
get_current_registry().settings = settings
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('about', '/about')
config.add_route('admin', '/admin')
config.add_route('admin_list', '/admin/users/{page}')
config.add_route('admin_user', '/admin/detail/{user}')
config.add_route('delete_user', '/admin/delete/user/{user}')
config.add_route('signup', '/signup')
config.add_route('submitSignup', '/signup/submit')
config.add_route('logout', '/logout')
config.add_route('login', '/login')
config.add_route('submitLogin', '/login/submit')
config.add_route('checkLogin', '/check/{userid}/{randomid}')
config.add_route('submitcheckLogin', '/check/{userid}/{randomid}/submit')
config.add_route('addLink', '/link/add')
config.add_route('submitLink', '/link/submit')
config.add_route("copyLink", '/copy/{link}')
config.add_route("link", '/link/{link}')
config.add_route('comment', '/comment/{link}')
config.add_route('rmComment', '/rmcomment/{link}/{userid}/{date}')
config.add_route("rmLink", '/link/delete/{link}')
config.add_route("mylinks", '/mylinks')
config.add_route('user', '/user/{userid}')
config.add_route('profile', '/profile')
config.add_route('avatar', '/avatar/{userid}')
config.add_route('tag', '/tag/{tag}')
config.add_route('rss', '/rss')
config.add_route('userrss', '/user/{userid}/rss')
config.add_route('tagrss', '/tag/{tag}/rss')
config.add_route('contacts', '/contacts')
config.add_route('submitContact', '/submitContact')
config.add_route('unfollow', '/unfollow/{userid}')
config.add_route('confirmUnfollow', '/confirmUnfollow/{userid}')
config.add_route('contactsLinks', '/contactsLinks')
config.add_route('cloudTags', '/cloudTags')
config.add_route('getTitle', '/ajax/gettitle')
config.add_view_predicate('logged', LoggedPredicate)
config.add_view_predicate('is_admin', Is_AdminPredicate)
for include in ['pyramid_mailer',
'pyramid_fanstatic',
'pyramid_chameleon',
'pyramid_beaker',
'rebecca.fanstatic', ]:
config.include(include)
config.add_fanstatic_resources(['js.bootstrap.bootstrap',
'js.bootstrap.bootstrap_theme',
'css.fontawesome.fontawesome',
'wsgiwars.resources.cssLink'
], r'.*\.pt')
config.scan()
return config.make_wsgi_app()