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


Python socketserver.ThreadingMixIn方法代码示例

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


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

示例1: run

# 需要导入模块: from django.utils.six.moves import socketserver [as 别名]
# 或者: from django.utils.six.moves.socketserver import ThreadingMixIn [as 别名]
def run(addr, port, wsgi_handler, ipv6=False, threading=False):
    server_address = (addr, port)
    if threading:
        httpd_cls = type(str('WSGIServer'), (socketserver.ThreadingMixIn, WSGIServer), {})
    else:
        httpd_cls = WSGIServer
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
    if threading:
        # ThreadingMixIn.daemon_threads indicates how threads will behave on an
        # abrupt shutdown; like quitting the server by the user or restarting
        # by the auto-reloader. True means the server will not wait for thread
        # termination before it quits. This will make auto-reloader faster
        # and will prevent the need to kill the server manually if a thread
        # isn't terminating correctly.
        httpd.daemon_threads = True
    httpd.set_app(wsgi_handler)
    httpd.serve_forever() 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:19,代码来源:basehttp.py

示例2: run

# 需要导入模块: from django.utils.six.moves import socketserver [as 别名]
# 或者: from django.utils.six.moves.socketserver import ThreadingMixIn [as 别名]
def run(addr, port, wsgi_handler, ipv6=False, threading=False, server_cls=WSGIServer):
    server_address = (addr, port)
    if threading:
        httpd_cls = type(str('WSGIServer'), (socketserver.ThreadingMixIn, server_cls), {})
    else:
        httpd_cls = server_cls
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
    if threading:
        # ThreadingMixIn.daemon_threads indicates how threads will behave on an
        # abrupt shutdown; like quitting the server by the user or restarting
        # by the auto-reloader. True means the server will not wait for thread
        # termination before it quits. This will make auto-reloader faster
        # and will prevent the need to kill the server manually if a thread
        # isn't terminating correctly.
        httpd.daemon_threads = True
    httpd.set_app(wsgi_handler)
    httpd.serve_forever() 
开发者ID:prakharchoudhary,项目名称:Scrum,代码行数:19,代码来源:basehttp.py

示例3: run

# 需要导入模块: from django.utils.six.moves import socketserver [as 别名]
# 或者: from django.utils.six.moves.socketserver import ThreadingMixIn [as 别名]
def run(addr, port, wsgi_handler, ipv6=False, threading=False):
    server_address = (addr, port)
    if threading:
        httpd_cls = type(str('WSGIServer'), (socketserver.ThreadingMixIn, WSGIServer), {})
    else:
        httpd_cls = WSGIServer
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
    httpd.set_app(wsgi_handler)
    httpd.serve_forever() 
开发者ID:VirtualPlants,项目名称:tissuelab,代码行数:11,代码来源:basehttp.py


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