本文整理汇总了Python中tg.configuration.AppConfig.serve_static方法的典型用法代码示例。如果您正苦于以下问题:Python AppConfig.serve_static方法的具体用法?Python AppConfig.serve_static怎么用?Python AppConfig.serve_static使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tg.configuration.AppConfig
的用法示例。
在下文中一共展示了AppConfig.serve_static方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_serve_statics
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import serve_static [as 别名]
def test_serve_statics(self):
class RootController(TGController):
@expose()
def test(self):
return 'HI!'
conf = AppConfig(minimal=True, root_controller=RootController())
conf.package = PackageWithModel()
conf.serve_static = True
app = conf.make_wsgi_app()
assert app.__class__.__name__.startswith('Statics')
app = TestApp(app)
assert 'HI!' in app.get('/test')
示例2: asbool
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import serve_static [as 别名]
setting = asbool(global_conf.get('the_setting'))
"""
from tg.configuration import AppConfig
import wesstats
from wesstats import model
from wesstats.lib import app_globals, helpers
base_config = AppConfig()
base_config.renderers = []
base_config.package = wesstats
base_config.serve_static = True
#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 = False
base_config.model = wesstats.model
base_config.DBSession = wesstats.model.DBSession
# Configure the authentication backend