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


Python Application.settings方法代码示例

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


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

示例1: get_app

# 需要导入模块: from tornado.web import Application [as 别名]
# 或者: from tornado.web.Application import settings [as 别名]
    def get_app(self):
        """
        setup tornado application for this test
        """

        app = Application(
            [(r"/login/(.+)", login.RequestHandler), (r"/document-secure/(.+)", document_secure.RequestHandler)]
        )

        app.settings = {"cookie_secret": "swipetechnologies"}

        return app
开发者ID:paprockiw,项目名称:dra-tornado,代码行数:14,代码来源:document_secure_test.py

示例2: make_app

# 需要导入模块: from tornado.web import Application [as 别名]
# 或者: from tornado.web.Application import settings [as 别名]
def make_app(config=None):
    root = path.dirname(__file__)
    static_path = path.join(root, 'static')
    template_path = path.join(root, 'template')

    app_config = dict(static_path=static_path,
                      template_path=template_path)

    define('port', default='8080', type=int)
    define('address', default='localhost', type=str)
    define('testing', default=False, type=bool)
    define('repo', default=None, type=str)
    define('username', default=None, type=str)
    define('pwdhash', default=None, type=str)
    define('autosave', default=False, type=bool)
    define('prefix', default='/', type=str)
    define('autosave_interval', default='5', type=int)
    define('wysiwyg', default=False, type=bool)
    define('theme', default=None, type=str)

    if config is not None:
        # This should only ever be used for testing
        parse_config_file(config)
    else:
        parse_config_file(config_path.web)

    if options.testing:
        app_config.update(debug=True)

    if not options.prefix.endswith('/'):
        options.prefix += '/'
    urls = get_urls(options.prefix)

    app_config.update(
      login_url=options.prefix + 'login',
      static_url_prefix=options.prefix + 'static/')

    server = Application(urls, **app_config)
    server.settings = AttrDict(server.settings)
    server.settings.repo = options.repo
    server.settings.username = options.username
    server.settings.pwdhash = options.pwdhash
    server.settings.session = _rand_str()
    server.settings.config_path = config_path
    server.settings.autosave = options.autosave
    server.settings.prefix = options.prefix
    server.settings.autosave_interval = options.autosave_interval
    server.settings.wysiwyg = options.wysiwyg
    server.settings.theme = options.theme

    server.git = git.bake(_cwd=server.settings.repo)

    return server
开发者ID:BBBSnowball,项目名称:magpie,代码行数:55,代码来源:server.py

示例3: get_app

# 需要导入模块: from tornado.web import Application [as 别名]
# 或者: from tornado.web.Application import settings [as 别名]
    def get_app(self):
        """
        setup tornado application for this test
        """

        app = Application([
            (r'/document/(.+)', document.RequestHandler)
        ])

        app.settings = {
            'cookie_secret': 'swipetechnologies'
        }

        return app
开发者ID:paprockiw,项目名称:dra-tornado,代码行数:16,代码来源:document_test.py

示例4: get_app

# 需要导入模块: from tornado.web import Application [as 别名]
# 或者: from tornado.web.Application import settings [as 别名]
    def get_app(self):
        """
        setup tornado application for this test
        """

        app = Application([
            (r'/login/(.+)', login.RequestHandler)
        ])

        # for generating cookies
        app.settings = {
            'cookie_secret': 'swipetechnologies'
        }

        return app
开发者ID:paprockiw,项目名称:dra-tornado,代码行数:17,代码来源:login_test.py

示例5: make_app

# 需要导入模块: from tornado.web import Application [as 别名]
# 或者: from tornado.web.Application import settings [as 别名]
def make_app(config=None):
    root = path.dirname(__file__)
    static_path = path.join(root, 'static')
    template_path = path.join(root, 'template')

    app_config = dict(static_path=static_path,
                      template_path=template_path,
                      login_url='/login')

    define('port', default='8080', type=int)
    define('address', default='localhost', type=str)
    define('testing', default=False, type=bool)
    define('repo', default=None, type=str)
    define('username', default=None, type=str)
    define('pwdhash', default=None, type=str)
    define('autosave', default=False, type=bool)

    if config is not None:
        # This should only ever be used for testing
        parse_config_file(config)
    else:
        parse_config_file(config_path.web)

    if options.testing:
        app_config.update(debug=True)

    server = Application(urls, **app_config)
    server.settings = AttrDict(server.settings)
    server.settings.repo = options.repo
    server.settings.username = options.username
    server.settings.pwdhash = options.pwdhash
    server.settings.session = _rand_str()
    server.settings.config_path = config_path
    server.settings.autosave = options.autosave

    server.git = git.bake(_cwd=server.settings.repo)

    return server
开发者ID:Erwyn,项目名称:magpie,代码行数:40,代码来源:server.py

示例6: dict

# 需要导入模块: from tornado.web import Application [as 别名]
# 或者: from tornado.web.Application import settings [as 别名]
app_config = dict(static_path=static_path,
                  template_path=template_path,
                  login_url='/login')

define('port', default='8080', type=int)
define('testing', default=False, type=bool)
define('repo', default=None, type=str)
define('username', default=None, type=str)
define('pwdhash', default=None, type=str)
parse_config_file(config_path.web)

if options.testing:
    app_config.update(debug=True)

server = Application(urls, **app_config)
server.settings = AttrDict(server.settings)
server.settings.repo = options.repo
server.settings.username = options.username
server.settings.pwdhash = options.pwdhash
server.settings.session = _rand_str()
server.settings.config_path = config_path

def main():
    server.git = git.bake(_cwd=server.settings.repo)
    server.listen(options.port, 'localhost')
    autoreload.start()
    autoreload.watch(config_path.web)
    IOLoop.instance().start()

if __name__ == '__main__':
    main()
开发者ID:arun057,项目名称:magpie,代码行数:33,代码来源:server.py


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