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


Python translogger.TransLogger方法代码示例

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


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

示例1: run_server

# 需要导入模块: from paste import translogger [as 别名]
# 或者: from paste.translogger import TransLogger [as 别名]
def run_server():
    # Enable WSGI access logging via Paste
    app_logged = TransLogger(app)

    # Mount the WSGI callable object (app) on the root directory
    cherrypy.tree.graft(app_logged, '/')

    # Set the configuration of the web server
    cherrypy.config.update({
        'engine.autoreload_on': True,
        'log.screen': True,
        'log.error_file': "cherrypy.log",
        'server.socket_port': 5000,
        'server.socket_host': '0.0.0.0',
        'server.thread_pool': 50, # 10 is default
    })

    # Start the CherryPy WSGI web server
    cherrypy.engine.start()
    cherrypy.engine.block()

# Connection 
开发者ID:Azure,项目名称:sql_python_deep_learning,代码行数:24,代码来源:api_service.py

示例2: run

# 需要导入模块: from paste import translogger [as 别名]
# 或者: from paste.translogger import TransLogger [as 别名]
def run(self, handler): # pragma: no cover
        from paste import httpserver
        from paste.translogger import TransLogger
        handler = TransLogger(handler, setup_console_handler=(not self.quiet))
        httpserver.serve(handler, host=self.host, port=str(self.port),
                         **self.options) 
开发者ID:Autodesk,项目名称:arnold-usd,代码行数:8,代码来源:__init__.py

示例3: run

# 需要导入模块: from paste import translogger [as 别名]
# 或者: from paste.translogger import TransLogger [as 别名]
def run(self, handler): # pragma: no cover
        from paste import httpserver
        if not self.quiet:
            from paste.translogger import TransLogger
            handler = TransLogger(handler)
        httpserver.serve(handler, host=self.host, port=str(self.port),
                         **self.options) 
开发者ID:exiahuang,项目名称:SalesforceXyTools,代码行数:9,代码来源:bottle.py

示例4: run

# 需要导入模块: from paste import translogger [as 别名]
# 或者: from paste.translogger import TransLogger [as 别名]
def run(self, handler):  # pragma: no cover
        from paste import httpserver
        from paste.translogger import TransLogger
        handler = TransLogger(handler, setup_console_handler=(not self.quiet))
        httpserver.serve(handler,
                         host=self.host,
                         port=str(self.port), **self.options) 
开发者ID:brycesub,项目名称:silvia-pi,代码行数:9,代码来源:bottle.py

示例5: run

# 需要导入模块: from paste import translogger [as 别名]
# 或者: from paste.translogger import TransLogger [as 别名]
def run(self, handler):  # 重写 run() 函数.
        from paste import httpserver
        from paste.translogger import TransLogger

        app = TransLogger(handler)
        httpserver.serve(app, host=self.host, port=str(self.port)) 
开发者ID:hhstore,项目名称:annotated-py-bottle,代码行数:8,代码来源:bottle.py

示例6: run

# 需要导入模块: from paste import translogger [as 别名]
# 或者: from paste.translogger import TransLogger [as 别名]
def run(self, handler): # pragma: no cover
        from paste import httpserver
        from paste.translogger import TransLogger
        app = TransLogger(handler)
        httpserver.serve(app, host=self.host, port=str(self.port), **self.options) 
开发者ID:lrq3000,项目名称:pyFileFixity,代码行数:7,代码来源:bottle2.py

示例7: run

# 需要导入模块: from paste import translogger [as 别名]
# 或者: from paste.translogger import TransLogger [as 别名]
def run(self, netloc='0.0.0.0:9090', reload=True, log=True):
        """Run the CherryPy server."""
        from django.conf import settings
        from django.core.handlers.wsgi import WSGIHandler
        from paste.translogger import TransLogger

        url_parts = urlparse.urlsplit(netloc)
        host = "0.0.0.0"
        port = 9090
        cherrypy.config.update({
            'server.socket_host': host,
            'server.socket_port': port,
            'log.screen': False,
            'engine.autoreload.on': reload,
            'log.access_file': cherry_access_log,
            'log.error_file': cherry_error_log,
        })
        self.cfg_assets(settings.MEDIA_URL, settings.MEDIA_ROOT)
        self.cfg_assets(settings.STATIC_URL, settings.STATIC_ROOT)
        self.cfg_favicon(settings.STATIC_ROOT)
        app = WSGIHandler()
        app = TransLogger(app, logger_name='cherrypy.access',
                          setup_console_handler=False)
        if self.domains:
            app = cherrypy.wsgi.VirtualHost(app, self.domains)
        cherrypy.tree.graft(app)
        cherrypy.engine.start() 
开发者ID:diegojromerolopez,项目名称:djanban,代码行数:29,代码来源:desktop_app_main.py

示例8: start_cherrypy

# 需要导入模块: from paste import translogger [as 别名]
# 或者: from paste.translogger import TransLogger [as 别名]
def start_cherrypy(app,
                   host=None,
                   port=None,
                   ssl_cert_file=None,
                   ssl_key_file=None,
                   is_dev_env=None):

    if not is_dev_env:
        cherrypy.config.update({'environment': 'production'})

    cherrypy.config.update(config.get_cherrypy_config())

    cherrypy.config.update({
        'log.screen': False,
        'server.socket_port': port,
        'server.socket_host': host,
        'server.ssl_certificate': ssl_cert_file,
        'server.ssl_private_key': ssl_key_file
    })

    app_logged = TransLogger(app.wsgi_app, setup_console_handler=False)
    cherrypy.tree.graft(app_logged, '/')

    if not is_dev_env:
        Daemonizer(cherrypy.engine).subscribe()
        PIDFile(cherrypy.engine, os.path.join(util.get_user_directory(),
                                              PID_FILE_NAME)).subscribe()

    cherrypy.engine.start()
    cherrypy.engine.block() 
开发者ID:HewlettPackard,项目名称:oneview-redfish-toolkit,代码行数:32,代码来源:app.py

示例9: start_server

# 需要导入模块: from paste import translogger [as 别名]
# 或者: from paste.translogger import TransLogger [as 别名]
def start_server(self):
    app = self.app

    @app.route('/subtitles.vtt')
    def subtitles():
      # response = bottle.static_file(self.subtitles_fn, root='/', mimetype='text/vtt')
      response = bottle.response
      response.headers['Access-Control-Allow-Origin'] = '*'
      response.headers['Access-Control-Allow-Methods'] = 'GET, HEAD'
      response.headers['Access-Control-Allow-Headers'] = 'Content-Type'
      response.headers['Content-Type'] = 'text/vtt'
      return self.subtitles

    @app.get('/media/<id>.<ext>')
    def video(id, ext):
      print(list(bottle.request.headers.items()))
      ranges = list(bottle.parse_range_header(bottle.request.environ['HTTP_RANGE'], 1000000000000))
      print('ranges', ranges)
      offset, end = ranges[0]
      self.transcoder.wait_for_byte(offset)
      response = bottle.static_file(self.transcoder.fn, root='/')
      if 'Last-Modified' in response.headers:
        del response.headers['Last-Modified']
      response.headers['Access-Control-Allow-Origin'] = '*'
      response.headers['Access-Control-Allow-Methods'] = 'GET, HEAD'
      response.headers['Access-Control-Allow-Headers'] = 'Content-Type'
      return response

    # app.run(host=self.ip, port=self.port, server='paste', daemon=True)
    from paste import httpserver
    from paste.translogger import TransLogger
    handler = TransLogger(app, setup_console_handler=True)
    httpserver.serve(handler, host=self.ip, port=str(self.port), daemon_threads=True) 
开发者ID:keredson,项目名称:gnomecast,代码行数:35,代码来源:gnomecast.py


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