• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python autoreload.start函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tornado.autoreload.start函数的典型用法代码示例。如果您正苦于以下问题:Python start函数的具体用法?Python start怎么用?Python start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: runloop

def runloop(addr, port, xheaders, no_keep_alive, use_reloader):
    router = SockJSRouter(Connection, '/updates')
    handlers = [
        (r'/', MainHandler),
        (r'/static/(.*)', tornado.web.StaticFileHandler, {'path': os.path.join(FILE_ROOT, 'static/')}),
    ] + router.urls
    tornado_app = tornado.web.Application(handlers)

    # start tornado web server in single-threaded mode
    # instead auto pre-fork mode with bind/start.
    http_server = httpserver.HTTPServer(tornado_app, xheaders=xheaders, no_keep_alive=no_keep_alive)
    http_server.listen(int(port), address=addr)

    main_loop = tornado.ioloop.IOLoop.instance()
    try:
        print "Runing on :{port}".format(port=port)
        main_loop.start()

    except KeyboardInterrupt:
        print "Stopped"
        sys.exit(0)

    if use_reloader:
        # Use tornado reload to handle IOLoop restarting.
        from tornado import autoreload
        autoreload.start()

    quit_command = (sys.platform == 'win32') and 'CTRL-BREAK' or 'CONTROL-C'
    print quit_command + " to quit."
开发者ID:naarcini,项目名称:hat,代码行数:29,代码来源:loop.py


示例2: run

    def run(self, args):
        settings = self.get_settings()

        for name in map(basename, glob(join('controllers', '*.py'))):
            autoreload.watch(name)
            Module.load(self.get_controller_import_path(name))

        from shrine.routes import make_application

        MESSAGE = "{} running at http://localhost:{}\n".format(
            settings.PRODUCT_NAME,
            settings.PORT,
        )

        application = make_application()
        application.listen(settings.PORT)
        self.log.bold_green(MESSAGE)

        from shrine.log import logger
        logger.setLevel(logging.WARNING)

        try:
            autoreload.start()
            IOLoop.instance().start()
        except KeyboardInterrupt:
            self.log.bold_red_on_black("\rInterrupted by the User (Control-C)\n")
开发者ID:gabrielfalcao,项目名称:shrine,代码行数:26,代码来源:run.py


示例3: runloop

def runloop(addr, port, xheaders, no_keep_alive, use_reloader, daemonize=False):
    router = SockJSRouter(Connection, '/updates')
    handlers = router.urls + [
        (r'/', TeaOrbitHandler),
        (r'/static/(.*)', tornado.web.StaticFileHandler, {'path': os.path.join(FILE_ROOT, 'static/')}),
        (r'/(?P<room_name>.*)', TeaOrbitHandler),
    ]
    tornado_app = tornado.web.Application(handlers)

    # start tornado web server in single-threaded mode
    # instead auto pre-fork mode with bind/start.
    http_server = httpserver.HTTPServer(tornado_app, xheaders=xheaders, no_keep_alive=no_keep_alive)
    http_server.listen(int(port), address=addr)

    main_loop = tornado.ioloop.IOLoop.instance()

    if use_reloader:
        # Use tornado reload to handle IOLoop restarting.
        from tornado import autoreload
        autoreload.start()
        for (path, dirs, files) in os.walk(os.path.join(FILE_ROOT)):
            for item in files:
                tornado.autoreload.watch(os.path.join(path, item))

    try:
        print "*** listening on :{port}".format(port=port)
        if daemonize is True:
            log = open('tornado.log', 'a+')
            ctx = daemon.DaemonContext(stdout=log, stderr=log, working_directory='.')
            ctx.open()
        main_loop.start()

    except KeyboardInterrupt:
        print "Stopped"
        sys.exit(0)
开发者ID:mayfer,项目名称:teaorbit,代码行数:35,代码来源:loop.py


示例4: run

    def run(self, reload,  logging, **kwargs):
        config = self._commandor_res

        if not config:
            self.error("You need specify --config\n")
            self.exit()

        configure_logging(logging)

        self.application = AggregatorApplication(config)
        ioloop = tornado.ioloop.IOLoop.instance()

        self.application.configure_app(ioloop)

        if reload:
            self.display("Autoreload enabled")
            autoreload.start(io_loop=ioloop, check_time=100)

        # Init signals handler
        signal.signal(signal.SIGTERM, self.sig_handler)

        # This will also catch KeyboardInterrupt exception
        signal.signal(signal.SIGINT, self.sig_handler)

        ioloop.start()
开发者ID:GottWall,项目名称:GottWall,代码行数:25,代码来源:runner.py


示例5: main

def main():
    server = make_app()
    server.listen(options.port, options.address)
    print('listening on ' + str(options.address) + ':' + str(options.port))
    autoreload.start()
    autoreload.watch(config_path.web)
    IOLoop.instance().start()
开发者ID:damoeb,项目名称:magpie,代码行数:7,代码来源:server.py


示例6: run

def run():
    router = SockJSRouter(connections.PhotoStream, settings.SOCKET_STREAMER_URL)

    handlers = router.urls

    runtime_vars = dict()

    runtime_vars["last_obj_count"] = None
    runtime_vars.update(MultiuploaderImage.objects.aggregate(last_upload=Max('upload_date')))

    def db_periodic_check(*a, **kw):
        obj_count = MultiuploaderImage.objects.count()
        if obj_count != runtime_vars["last_obj_count"]:
            runtime_vars["last_obj_count"] = obj_count
            if not runtime_vars["last_upload"] is None:
                objs = MultiuploaderImage.objects.filter(upload_date__gt=runtime_vars["last_upload"])
                runtime_vars.update(MultiuploaderImage.objects.aggregate(last_upload=Max('upload_date')))
                for obj in objs:
                    for user in connections.PhotoStream.connected_users:
                        user.notify_new_entry(obj)

    app = web.Application(handlers)
    app.listen(int(settings.SOCKET_STREAMER_PORT), "0.0.0.0")
    ioloop.PeriodicCallback(db_periodic_check, 1000).start()
    autoreload.start(ioloop.IOLoop.instance())
    print "socket streamer is (re)started"
    try:
        ioloop.IOLoop.instance().start()
    except KeyboardInterrupt:
        return
开发者ID:echalkpad,项目名称:xauto,代码行数:30,代码来源:main.py


示例7: main

    def main(self):

        #settings passed to tornado app
        tornado_settings = {
            "template_path": settings.template_path,
            "static_path": settings.static_path,
            "cookie_secret": settings.cookie_secret,
            "login_url": settings.login_url,
        }

        #init a logger
        self.init_logging(settings.log)

        #routes
        routes = self.init_routes()

        self._application = web.Application(routes,**tornado_settings)

        http_server = httpserver.HTTPServer(self._application)
        http_server.listen(settings.port)

        Log.info("Ready and listening")

        ioloop = tornado.ioloop.IOLoop().instance()
        autoreload.start(ioloop)
        try:
            ioloop.start()
        except KeyboardInterrupt:
            pass
开发者ID:uniwolf,项目名称:tornado-bootstrap,代码行数:29,代码来源:server.py


示例8: main

def main() -> None:
    '''Runs server'''

    # Parse options
    define('production',
               default = False,
               help = 'run in production mode',
               type = bool)
    options.parse_command_line()

    # Set server name
    pname = settings.process_name if settings.process_name else None
    if pname:
        setproctitle(pname)

    # Register IRC server
    server = IRCServer(settings = ircdsettings)
    for address, port in ircdsettings['listen']:
        server.listen(port, address = address)

    # Start profiling
    if settings.profiling:
        import yappi
        yappi.start()

    # Setup autoreload
    autoreload.start()

    # Run application
    IOLoop.instance().start()
开发者ID:leandropls,项目名称:tornadoirc,代码行数:30,代码来源:server.py


示例9: main

def main():
    parse_command_line()
    http_server = tornado.httpserver.HTTPServer(Application())
    http_server.listen(options.port)
    ioloop = tornado.ioloop.IOLoop().instance()
    autoreload.start(ioloop)
    ioloop.start()
开发者ID:ErDmKo,项目名称:pyparser,代码行数:7,代码来源:server.py


示例10: startTornado

def startTornado():
    global http_server
    http_server = HTTPServer(WSGIContainer(create_app("settings.DevelopmentConfig")))
    http_server.listen(80)
    ioloop = IOLoop.instance()
    autoreload.start(ioloop)
    ioloop.start()
开发者ID:emmdim,项目名称:wibed-controller,代码行数:7,代码来源:tornadoserver.py


示例11: start_thememapper

def start_thememapper():
    global nav
    global mapper
    #initialize the necessary classes
    mapper = Mapper(get_settings())
    nav = Navigation()
    # Adds the ability to set config file and port through commandline
    p = optparse.OptionParser()
    p.add_option('--port', '-p', default=mapper.port,help='port thememapper should run at')
    p.add_option('--diazo', '-d', default=False,action="store_true",dest="diazo",help='force diazo server to run')
    p.add_option('--diazo_port', '-f', default=mapper.diazo_port,help='port diazo should run at')
    options = p.parse_args()[0]
    mapper.port = options.port
    mapper.diazo_port = options.diazo_port
    #start thememapper
    print "Starting thememapper on http://0.0.0.0:" + mapper.port
    HTTPServer(WSGIContainer(app)).listen(mapper.port)
    if options.diazo or mapper.diazo_run == 'True':
        try: 
            from thememapper.diazo import server
            print "Starting diazo on http://0.0.0.0:" + mapper.diazo_port
            HTTPServer(server.get_application(mapper)).listen(mapper.diazo_port)
        except ImportError: 
            print "You will need to install thememapper.diazo before being able to use this function." 
    ioloop = IOLoop.instance()
    autoreload.watch(os.path.join(os.path.dirname(__file__), 'settings.properties'))
    autoreload.add_reload_hook(reload)
    autoreload.start(ioloop)
    ioloop.start()
开发者ID:Goldmund-Wyldebeast-Wunderliebe,项目名称:thememapper.core,代码行数:29,代码来源:main.py


示例12: enable_autoreload

 def enable_autoreload(self, watch_dirs=list()):
     for current_dir in watch_dirs:
         if not os.path.isdir(current_dir):
             continue
         for (path, dirs, files) in os.walk(current_dir):
             for item in files:
                 autoreload.watch(os.path.join(path, item))
     autoreload.start(self.__io_loop)
开发者ID:uzumaxy,项目名称:pyspectator_tornado,代码行数:8,代码来源:web_server.py


示例13: main

def main():
    server.git = git.bake(_cwd=server.settings.repo)
    if options.listen_localhost_only:
        server.listen(options.port, 'localhost')
    else:
        server.listen(options.port)
    autoreload.start()
    autoreload.watch(config_path.web)
    IOLoop.instance().start()
开发者ID:ThomicArt,项目名称:magpie,代码行数:9,代码来源:server.py


示例14: start_diazo_server

def start_diazo_server(settings):
    app = get_application(settings)
    if app is not False:
        print "Starting diazo on http://0.0.0.0:" + settings['diazo_port']
        HTTPServer(app).listen(settings['diazo_port'])
        ioloop = IOLoop.instance()
        autoreload.add_reload_hook(reload)
        autoreload.start(ioloop)
        ioloop.start()
开发者ID:C4RoCKeT,项目名称:thememapper.diazo,代码行数:9,代码来源:server.py


示例15: main

def main():
    options.parse_command_line()

    app = web.Application([
        (r'/(.*?)', CacheHandler)
    ])
    app.listen(int(getconfig('server_port')))
    autoreload.start()
    ioloop.IOLoop.instance().start()
开发者ID:ttrifonov,项目名称:pip-proxy,代码行数:9,代码来源:pip-proxy.py


示例16: app_autoreload

def app_autoreload(app, timeout):
    """Set application autoreload. This option available only on Debug mod."""

    if app.config.get_settings_item('run', 'debug'):
        from tornado import autoreload
        autoreload.start(
            io_loop=tornado.ioloop.IOLoop.current(),
            check_time=2
        )
开发者ID:OlefirenkoK,项目名称:training_process,代码行数:9,代码来源:app.py


示例17: serve

def serve(options):
    """Serves the server"""
    config = options.config
    app = Application(config)
    http_server = tornado.httpserver.HTTPServer(app)
    http_server.listen(WEB_PORT)
    ioloop = tornado.ioloop.IOLoop.instance()
    autoreload.start(ioloop)
    ioloop.start()
开发者ID:idalab,项目名称:apiready,代码行数:9,代码来源:apireader.py


示例18: __init__

    def __init__(self, handler_class, **settings):
        self.handler_class = handler_class
        self.settings = settings
        if self.settings.get('debug'):
            self.settings.setdefault('autoreload', True)

        # Automatically reload modified modules
        if self.settings.get('autoreload'):
            from tornado import autoreload
            autoreload.start()
开发者ID:puentesarrin,项目名称:bonzo,代码行数:10,代码来源:smtp.py


示例19: handle

    def handle(self, *args, **options):
        logging.info("Start tornado application on %s port %s" % (DEFAULT_IP, DEFAULT_PORT))
        server = HTTPServer(request_callback=App())
        server.listen(port=DEFAULT_PORT, address=DEFAULT_IP)
        io_loop = IOLoop.instance()

        if hasattr(settings, 'TORNADO_DEBUG'):
            autoreload.start(io_loop)

        io_loop.start()
开发者ID:it-columbo,项目名称:royalty,代码行数:10,代码来源:interface.py


示例20: main

def main():
    from tornado.httpserver import HTTPServer 
    tornado.options.parse_command_line()
    http_server = tornado.httpserver.HTTPServer(Application())
    real_port = options.port - options.port_offset
    http_server.listen(real_port)
    print('Listening at port %s' % real_port)
    
    ioloop = tornado.ioloop.IOLoop.instance()
    autoreload.start(ioloop)
    ioloop.start()
开发者ID:Dealflicks,项目名称:flickit,代码行数:11,代码来源:server.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python concurrent.chain_future函数代码示例发布时间:2022-05-27
下一篇:
Python tornadio2.TornadioRouter类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap