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


Python AppConfig.call_on_startup方法代码示例

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


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

示例1: MySQLAlchemyAuthenticatorPlugin

# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import call_on_startup [as 别名]
base_config.sa_auth.group_class = model.Group
# what is the class you want to use to search for permissions in the database
base_config.sa_auth.permission_class = model.Permission

# override this if you would like to provide a different who plugin for
# managing login and logout of your application
myPlugin = MySQLAlchemyAuthenticatorPlugin(model.User, model.DBSession)

base_config.sa_auth.authenticators = [("MySQLAlchemyAuthenticatorPlugin", myPlugin)]


# You may optionally define a page where you want users to be redirected to
# on login:
base_config.sa_auth.post_login_url = '/post_login'

# You may optionally define a page where you want users to be redirected to
# on logout:
base_config.sa_auth.post_logout_url = '/post_logout'

base_config.ldap = Bunch()
base_config.ldap.host = '192.168.42.167'
base_config.ldap.port = 389
base_config.ldap.basedn = ['ou=sz,dc=r-pac,dc=local', 'ou=hk,dc=r-pac,dc=local', 'ou=sh,dc=r-pac,dc=local']
base_config.ldap.initdn = 'CN=adAuth,OU=System Account,DC=r-pac,DC=local'
base_config.ldap.initpw = 'ky2379ck$'

#===============================================================================
# add the cron job , to send email on 13rd and 15th for DBA
#===============================================================================
base_config.call_on_startup=[dbaEmailNotify,sendInfo2mglobalpack]
开发者ID:LamCiuLoeng,项目名称:internal,代码行数:32,代码来源:app_cfg.py

示例2: on_startup

# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import call_on_startup [as 别名]
# managing login and logout of your application
base_config.sa_auth.form_plugin = None

# You may optionally define a page where you want users to be redirected to
# on login:
base_config.sa_auth.post_login_url = "/post_login"

# You may optionally define a page where you want users to be redirected to
# on logout:
base_config.sa_auth.post_logout_url = "/post_logout"

# Handle custom errors
base_config.handle_status_codes.append(400)

# Startup and shutdown
def on_startup():
    #    notify.connect()
    pass


def on_shutdown():
    pass


base_config.call_on_startup = [on_startup]
base_config.call_on_shutdown = [on_shutdown]

# ToscaWidgets
base_config.use_toscawidgets = False
base_config.use_toscawidgets2 = True
开发者ID:MrPetru,项目名称:spam,代码行数:32,代码来源:app_cfg.py

示例3:

# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import call_on_startup [as 别名]
#Set the default renderer
base_config.default_renderer = 'genshi'
base_config.renderers.append('genshi')
# if you want raw speed and have installed chameleon.genshi
# you should try to use this renderer instead.
# warning: for the moment chameleon does not handle i18n translations
#base_config.renderers.append('chameleon_genshi')

#Configure the base SQLALchemy Setup
base_config.use_sqlalchemy = True
base_config.model = bastion.model
base_config.DBSession = bastion.model.DBSession


# YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP
base_config.sa_auth.cookie_secret = "ChangeME"

# override this if you would like to provide a different who plugin for
# managing login and logout of your application
base_config.sa_auth.form_plugin = None

# You may optionally define a page where you want users to be redirected to
# on login:
base_config.sa_auth.post_login_url = '/post_login'

# You may optionally define a page where you want users to be redirected to
# on logout:
base_config.sa_auth.post_logout_url = '/post_logout'

base_config.call_on_startup = [schedule]
开发者ID:jokajak,项目名称:bastion,代码行数:32,代码来源:app_cfg.py


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