本文整理汇总了Python中pyramid.config.Configurator.configure_celery方法的典型用法代码示例。如果您正苦于以下问题:Python Configurator.configure_celery方法的具体用法?Python Configurator.configure_celery怎么用?Python Configurator.configure_celery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.config.Configurator
的用法示例。
在下文中一共展示了Configurator.configure_celery方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import configure_celery [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
set_cache_regions_from_settings(settings)
config = Configurator(settings=settings)
config.include('cms')
config.configure_celery(global_config['__file__'])
return config.make_wsgi_app()
示例2: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import configure_celery [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
config.add_translation_dirs('unicorecmsmama:locale')
config.include('cms')
config.configure_celery(global_config['__file__'])
config.add_static_view('static', 'static', cache_max_age=3600)
config.scan()
config.override_asset('cms:templates/', 'unicorecmsmama:templates/')
return config.make_wsgi_app()
示例3: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import configure_celery [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.add_translation_dirs('springboard:locale/')
config.configure_celery(global_config['__file__'])
return config.make_wsgi_app()
示例4: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import configure_celery [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
config = Configurator(settings=settings)
config.configure_celery(global_config['__file__'])
config.add_route('index', '/')
config.add_route('add_task', '/add_task')
config.add_route('delete_task', '/delete_task/{task_pk}')
config.scan()
return config.make_wsgi_app()
示例5: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import configure_celery [as 别名]
def main(global_config, **settings):
cp = ConfigParser()
cp.readfp(pkg_resources.resource_stream('springboard', 'defaults.ini'))
defaults = dict(cp.items('springboard:pyramid'))
filters = [
'recent_pages = springboard_iogt.filters:recent_pages',
'category_dict = springboard_iogt.filters:category_dict',
'content_section = springboard_iogt.filters:content_section'
]
defaults['jinja2.filters'] += '\n%s' % '\n'.join(filters)
defaults.update(settings)
config = Configurator(settings=defaults)
config.include('springboard_iogt.config')
config.configure_celery(global_config['__file__'])
return config.make_wsgi_app()
示例6: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import configure_celery [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)
config.add_translation_dirs('{{cookiecutter.app_name}}:locale/')
config.configure_celery(global_config['__file__'])
return config.make_wsgi_app()
示例7: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import configure_celery [as 别名]
def main(global_config, **settings):
engine = create_engine(os.environ['NEX2_URI'], pool_recycle=3600)
DBSession.configure(bind=engine)
Base.metadata.bind = engine
config = Configurator(settings=settings)
config.add_route('home', '/')
config.add_route('upload', '/upload')
config.add_route('search', '/get_search_results')
config.add_route('autocomplete_results', '/autocomplete_results')
config.add_route('colleague_triage_all', '/colleagues/triage', request_method='GET')
config.add_route('colleague_triage_accept', '/colleagues/triage/{id}', request_method='POST')
config.add_route('colleague_triage_update', '/colleagues/triage/{id}', request_method='PUT')
config.add_route('colleague_triage_delete', '/colleagues/triage/{id}', request_method='DELETE')
config.add_route('colleague_create', '/colleagues', request_method='POST')
config.add_route('colleague_update', '/colleagues/{format_name}', request_method='PUT')
config.add_route('colleague_get', '/colleagues/{format_name}', request_method='GET')
config.add_route('keywords', '/keywords')
config.add_route('formats', '/formats')
config.add_route('topics', '/topics')
config.add_route('extensions', '/extensions')
config.add_route('sign_in', '/signin')
config.add_route('sign_out', '/signout')
#NEX endpoints
config.add_route('reference_list', '/reference_list')
config.add_route('chemical', '/chemical/{id}/overview')
config.add_route('chemical_phenotype_details', '/chemical/{id}/phenotype_details')
config.scan()
config.add_static_view(name='static', path='../static')
config.configure_celery(global_config['__file__'])
return config.make_wsgi_app()
示例8: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import configure_celery [as 别名]
def main(global_config, **settings):
"""
This function returns a Pyramid WSGI application.
"""
from pyramid.config import Configurator
from pyramid.events import subscriber
from pyramid.events import NewRequest
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from phoenix.security import groupfinder, root_factory
# security
# TODO: move to security
authn_policy = AuthTktAuthenticationPolicy(
settings.get('authomatic.secret'), callback=groupfinder, hashalg='sha512')
authz_policy = ACLAuthorizationPolicy()
config = Configurator(root_factory=root_factory, settings=settings)
config.set_authentication_policy(authn_policy)
config.set_authorization_policy(authz_policy)
# beaker session
config.include('pyramid_beaker')
# chameleon templates
config.include('pyramid_chameleon')
# deform
#config.include('pyramid_deform')
#config.include('js.deform')
# mailer
config.include('pyramid_mailer')
# celery
config.include('pyramid_celery')
config.configure_celery(global_config['__file__'])
# ldap
config.include('pyramid_ldap')
# FK: Ldap setup functions will be called on demand.
# static views (stylesheets etc)
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_static_view('deform_static', 'deform:static', cache_max_age=3600)
# routes
config.add_route('home', '/')
# login
config.add_route('account_login', '/account/login/{protocol}')
config.add_route('account_logout', '/account/logout')
config.add_route('account_auth', '/account/auth/{provider_name}')
config.add_route('account_register', '/account/register')
# dashboard
config.add_route('dashboard', '/dashboard/{tab}')
# processes
config.add_route('processes', '/processes')
config.add_route('processes_list', '/processes/list')
config.add_route('processes_execute', '/processes/execute')
# job monitor
config.add_route('monitor', '/monitor')
config.add_route('remove_job', '/monitor/{job_id}/remove')
config.add_route('remove_all_jobs', '/monitor/remove_all')
config.add_route('update_myjobs', '/monitor/update.json')
config.add_route('monitor_details', '/monitor/{job_id}/{tab}')
# user profile
config.add_route('profile', '/profile/{tab}')
# settings
config.add_route('settings', '/settings')
config.add_route('settings_users', '/settings/users')
config.add_route('settings_edit_user', '/settings/users/{userid}/edit')
config.add_route('remove_user', '/settings/users/{userid}/remove')
config.add_route('settings_monitor', '/settings/monitor')
config.add_route('settings_auth', '/settings/auth')
config.add_route('settings_ldap', '/settings/ldap')
config.add_route('settings_solr', '/settings/solr/{tab}')
# supervisor
config.add_route('supervisor', '/supervisor')
config.add_route('supervisor_process', '/supervisor/{action}/{name}')
config.add_route('supervisor_log', '/supervisor_log/{name}')
# services
config.add_route('services', '/services')
config.add_route('register_service', '/services/register')
config.add_route('service_details', '/services/{service_id}')
config.add_route('remove_service', '/services/{service_id}/remove')
# solr
config.add_route('index_service', '/solr/{service_id}/index')
config.add_route('clear_index', '/solr/clear')
# wizard
config.add_route('wizard', '/wizard')
config.add_route('wizard_wps', '/wizard/wps')
#.........这里部分代码省略.........
示例9: main
# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import configure_celery [as 别名]
def main(global_config, **settings):
"""
This function returns a Pyramid WSGI application.
"""
from pyramid.config import Configurator
config = Configurator(settings=settings, autocommit=False)
# security
config.include('phoenix.security')
# beaker session
config.include('pyramid_beaker')
# chameleon templates
config.include('pyramid_chameleon')
# deform
# config.include('pyramid_deform')
# config.include('js.deform')
# mailer
config.include('pyramid_mailer')
# celery
config.include('pyramid_celery')
config.configure_celery(global_config['__file__'])
# static views (stylesheets etc)
config.add_static_view('static', 'static')
config.add_static_view('static_deform', 'deform:static')
# database
# TODO: overwrite request.db from twitcher
# See: http://docs.pylonsproject.org/projects/pyramid/en/latest/api/config.html
# config.include('phoenix.db')
from phoenix.db import includeme as include_db
include_db(config)
# twitcher
config.include('phoenix.twitcherclient')
# routes
config.add_route('home', '/')
# storage
config.include('phoenix.storage')
# settings
config.include('phoenix.settings')
# account
config.include('phoenix.account')
# dashboard
config.include('phoenix.dashboard')
# processes
config.include('phoenix.processes')
# job monitor
config.include('phoenix.monitor')
# esgf search
config.include('phoenix.esgf')
# user profiles
config.include('phoenix.people')
# catalog
config.include('phoenix.catalog')
# service settings
config.include('phoenix.services')
# cart
config.include('phoenix.cart')
# readthedocs
config.add_route('readthedocs', 'https://pyramid-phoenix.readthedocs.org/en/latest/{part}.html')
# max file size for upload in MB
def max_file_size(request):
settings = request.registry.settings
return int(settings.get('phoenix.max_file_size', '200'))
config.add_request_method(max_file_size, reify=True)
# use json_adapter for datetime
# http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/renderers.html#json-renderer
from pyramid.renderers import JSON
import datetime
json_renderer = JSON()
def datetime_adapter(obj, request):
return obj.isoformat()
json_renderer.add_adapter(datetime.datetime, datetime_adapter)
import bson
def objectid_adapter(obj, request):
return str(obj)
#.........这里部分代码省略.........