當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。