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


Python ObjectDict.template_path方法代码示例

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


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

示例1: load_config

# 需要导入模块: from tornado.util import ObjectDict [as 别名]
# 或者: from tornado.util.ObjectDict import template_path [as 别名]
def load_config(filename='config.py'):
    catsup_path = os.path.dirname(__file__)

    config = ObjectDict(
        catsup_path=catsup_path,
        posts_path=os.path.join(catsup_path, '_posts'),
        common_template_path=os.path.join(catsup_path, 'template'),
        deploy_path=os.path.join(catsup_path, 'deploy'),
        disqus_shortname='catsup',
        feed='feed.xml',
        post_per_page=3,
        gzip=True,
        static_url='static',
        theme_name='sealscript',
        google_analytics=''
    )

    execfile(filename, {}, config)

    if 'theme_path' not in config:
        config.theme_path = os.path.join(catsup_path, 'themes',
            config.theme_name)

    if 'template_path' not in config:
        config.template_path = os.path.join(config.theme_path, 'template')

    if 'static_path' not in config:
        config.static_path = os.path.join(config.theme_path, 'static')

    if config.site_url.endswith('/'):
        config.site_url = config.site_url[:-1]
    if config.static_url.endswith('/'):
        config.static_url = config.static_url[:-1]

    return config
开发者ID:zhengjingren,项目名称:catsup,代码行数:37,代码来源:utils.py

示例2: __init__

# 需要导入模块: from tornado.util import ObjectDict [as 别名]
# 或者: from tornado.util.ObjectDict import template_path [as 别名]
    def __init__(self):
        settings = ObjectDict()

        settings.debug = options.debug
        settings.autoescape = None
        self.base_dir = os.path.abspath(os.path.dirname(__file__))
        settings.template_path = os.path.join(self.base_dir, 'templates')

        handlers = [
                (r'/', IndexHandler),
                (r'/api/torrent/link', TorrentLinkHandler),
                (r'/api/torrent/file', TorrentFileHandler),
                (r'/api/torrent/bttiantang', TorrentBTTianTangHandler),
            ]

        super(Application, self).__init__(handlers, **settings)
开发者ID:cloverstd,项目名称:torrent2magnet,代码行数:18,代码来源:app.py

示例3: __init__

# 需要导入模块: from tornado.util import ObjectDict [as 别名]
# 或者: from tornado.util.ObjectDict import template_path [as 别名]
    def __init__(self):
        settings = ObjectDict()
        settings.debug = options.debug
        settings.autoescape = None
        self.base_dir = os.path.abspath(os.path.dirname(__file__))
        settings.template_path = os.path.join(self.base_dir, 'templates')
        settings.static_path = os.path.join(self.base_dir, 'static')

        handlers = [
                (r'/', IndexHandler),
                (r'/upload', IndexHandler),
                (r'/myfile', MyFileHandler),
                (r'/myfile/list', ListRemoteFileHandler),
                (r'/myfile/delete', DeleteRemoteFileHandler),
            ]

        super(Application, self).__init__(handlers, **settings)
开发者ID:cloverstd,项目名称:qiniuimgbed,代码行数:19,代码来源:app.py


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