本文整理汇总了Python中tg.configuration.AppConfig.use_ming方法的典型用法代码示例。如果您正苦于以下问题:Python AppConfig.use_ming方法的具体用法?Python AppConfig.use_ming怎么用?Python AppConfig.use_ming使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tg.configuration.AppConfig
的用法示例。
在下文中一共展示了AppConfig.use_ming方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_setup_ming_persistance_with_url_alone
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import use_ming [as 别名]
def test_setup_ming_persistance_with_url_alone(self):
if PY3: raise SkipTest()
package = PackageWithModel()
conf = AppConfig(minimal=True, root_controller=None)
conf.package = package
conf.model = package.model
conf.use_ming = True
conf['ming.url'] = 'mim://inmemdb'
app = conf.make_wsgi_app()
assert app is not None
示例2: test_setup_ming_persistance_advanced_options
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import use_ming [as 别名]
def test_setup_ming_persistance_advanced_options(self):
if PY3: raise SkipTest()
package = PackageWithModel()
conf = AppConfig(minimal=True, root_controller=None)
conf.package = package
conf.model = package.model
conf.use_ming = True
conf['ming.url'] = 'mim://inmemdb'
conf['ming.connection.read_preference'] = 'PRIMARY'
app = conf.make_wsgi_app()
assert app is not None
示例3: ApplicationAuthMetadata
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import use_ming [as 别名]
base_config.package = genfunc
# Enable json in expose
base_config.renderers.append('json')
# Enable genshi in expose to have a lingua franca
# for extensions and pluggable apps.
# You can remove this if you don't plan to use it.
base_config.renderers.append('genshi')
# Set the default renderer
base_config.default_renderer = 'genshi'
# Configure the base Ming Setup
base_config.use_sqlalchemy = False
base_config['tm.enabled'] = False
base_config.use_ming = True
base_config.model = genfunc.model
base_config.DBSession = genfunc.model.DBSession
# Configure the authentication backend
base_config.auth_backend = 'ming'
# YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP
base_config.sa_auth.cookie_secret = "db50d94a-1248-4dba-b571-9de0fdc98af0"
# what is the class you want to use to search for users in the database
base_config.sa_auth.user_class = model.User
from tg.configuration.auth import TGAuthMetadata
# This tells to TurboGears how to retrieve the data for your user
class ApplicationAuthMetadata(TGAuthMetadata):
def __init__(self, sa_auth):
示例4: asbool
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import use_ming [as 别名]
Please note that **all the argument values are strings**. If you want to
convert them into boolean, for example, you should use the
:func:`paste.deploy.converters.asbool` function, as in::
from paste.deploy.converters import asbool
setting = asbool(global_conf.get('the_setting'))
"""
from tg.configuration import AppConfig
import tg2raptorized
from tg2raptorized import model
from tg2raptorized.lib import app_globals, helpers
base_config = AppConfig()
base_config.renderers = []
base_config.package = tg2raptorized
#Enable json in expose
base_config.renderers.append('json')
#Set the default renderer
base_config.default_renderer = 'mako'
base_config.renderers.append('mako')
base_config.use_sqlalchemy=False
base_config.use_ming=False
base_config.use_transaction_manager=False
base_config.auth_backend=None
base_config.use_toscawidgets=False