コード例 #1
0
ファイル: trialrun.py プロジェクト: thepian/themaestro
    def __call__(self,*args,**options):
        from thepian.conf import structure
        from os.path import join
        
        sys.path.append(structure.PROJECT_DIR)
        
        from thepian.conf import ensure_target_tree
        ensure_target_tree(structure.PROJECT_DIR)
        #TODO part add_themaestro functionality

        import logging
        LOG_FILENAME = join(structure.PROJECT_DIR,'testing.log')
        logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
                
        from mediaserver import Application, HTTPServer
        import tornado.httpserver
        import tornado.ioloop
        import tornado.autoreload
        
        # print "js dir =", structure.JS_DIR
        # tornado.options.parse_command_line()
        ioloop = tornado.ioloop.IOLoop.instance()

        sock_path = join(structure.PROJECT_DIR,"mediasite.sock")
        port_no = structure.MEDIASERVER_PORT
        if port_no:
            http_server = tornado.httpserver.HTTPServer(Application(ioloop=ioloop))
            http_server.listen(port_no)
        else:
            http_server = HTTPServer(Application(ioloop=ioloop))
            http_server.listen(0,address = sock_path)
        
        tornado.autoreload.start(io_loop=ioloop)
        ioloop.start()
コード例 #2
0
ファイル: start.py プロジェクト: thepian/themaestro
    def __call__(self,*args,**options):
        from thepian.conf import structure
        from os.path import join
        
        from thepian.conf import ensure_target_tree
        ensure_target_tree(structure.PROJECT_DIR)
        #TODO part add_themaestro functionality

        sys.path.insert(0,structure.PROJECT_DIR)
        
        import logging
        print 'logging to testing.log', structure.DEFAULT_HOSTNAME
        LOG_FILENAME = join(structure.PROJECT_DIR,'testing.log')
        logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
        
        from mediaserver import Application, HTTPServer
        import tornado.httpserver
        import tornado.ioloop
        import tornado.autoreload
        
        ioloop = tornado.ioloop.IOLoop.instance()
        for n in structure.SITES:
            site = structure.SITES[n]
            print n+":", site["port"], site["package"]
            if site["package"] in ("tornado", "mediaserver"):
                http_server = tornado.httpserver.HTTPServer(Application(site,ioloop=ioloop))
                http_server.listen(site["port"])
        
        tornado.autoreload.start(io_loop=ioloop)
        ioloop.start()
コード例 #3
0
ファイル: enablesite.py プロジェクト: thepian/themaestro
    def __call__(self, *modulenames, **options):
        try:
            from maestro.config import ensure_areas, install_features

            ensure_target_tree(structure.PROJECT_DIR)
            ensure_areas()
            install_features()

        except Warning, e:
            # print self.style.NOTICE(e.message)
            print e