def load(self): f = open("sc.cache", "r") js = f.read() f.close() self.cache = json.loads(js) if __name__ == "__main__": urllib2.install_opener(urllib2.build_opener()) conf_path = os.path.abspath("web.conf") print "reading config from", conf_path cherrypy.config.update(conf_path) config = ConfigParser.ConfigParser() config.read(conf_path) production_mode = config.getboolean("settings", "production") current_dir = os.path.dirname(os.path.abspath(__file__)) # Set up site-wide config first so we get a log if errors occur. if production_mode: print "Starting in production mode" cherrypy.config.update({"environment": "production", "log.error_file": "simdemo.log", "log.screen": True}) else: print "Starting in development mode" cherrypy.config.update({"noenvironment": "production", "log.error_file": "site.log", "log.screen": True}) conf = webtools.get_export_map_for_directory("static") cherrypy.quickstart(SCAnalyzer(config), "/SCAnalyzer", config=conf)
def CORS(): cherrypy.response.headers["Access-Control-Allow-Origin"] = "*" cherrypy.response.headers['Content-Type']= 'application/json' def error_page_404(status, message, traceback, version): cherrypy.response.headers['Content-Type']= 'application/json' cherrypy.response.headers["Access-Control-Allow-Origin"] = "*" results = { 'status' : 'error', 'reason': message} return json.dumps(results) if __name__ == '__main__': cherrypy.tools.CORS = cherrypy.Tool('before_handler', CORS) config = { 'global' : { 'server.socket_host' : '0.0.0.0', 'server.socket_port' : 8235, 'server.thread_pool' : 10, }, '/' : { 'tools.CORS.on' : True, 'error_page.404': error_page_404, } } static_doc_config = webtools.get_export_map_for_directory("static") config.update(static_doc_config) cherrypy.quickstart(SongServer(), '/SortYourMusic', config=config)
urllib2.install_opener(urllib2.build_opener()) conf_path = os.path.abspath('web.conf') print 'reading config from', conf_path cherrypy.config.update(conf_path) config = ConfigParser.ConfigParser() config.read(conf_path) production_mode = config.getboolean('settings', 'production') current_dir = os.path.dirname(os.path.abspath(__file__)) # Set up site-wide config first so we get a log if errors occur. if production_mode: print "Starting in production mode" cherrypy.config.update({ 'environment': 'production', 'log.error_file': 'simdemo.log', 'log.screen': True }) else: print "Starting in development mode" cherrypy.config.update({ 'noenvironment': 'production', 'log.error_file': 'site.log', 'log.screen': True }) conf = webtools.get_export_map_for_directory("static") cherrypy.quickstart(CityServer(config), '/CityServer', config=conf)
results = callback + "(" + results + ")" return results if __name__ == '__main__': urllib2.install_opener(urllib2.build_opener()) conf_path = os.path.abspath('web.conf') print 'reading config from', conf_path cherrypy.config.update(conf_path) config = ConfigParser.ConfigParser() config.read(conf_path) production_mode = config.getboolean('settings', 'production') current_dir = os.path.dirname(os.path.abspath(__file__)) # Set up site-wide config first so we get a log if errors occur. if production_mode: print "Starting in production mode" cherrypy.config.update({'environment': 'production', 'log.error_file': 'simdemo.log', 'log.screen': True}) else: print "Starting in development mode" cherrypy.config.update({'noenvironment': 'production', 'log.error_file': 'site.log', 'log.screen': True}) conf = webtools.get_export_map_for_directory("client") cherrypy.quickstart(Server(config), '/3dServer', config=conf)
if __name__ == '__main__': urllib2.install_opener(urllib2.build_opener()) conf_path = os.path.abspath('web.conf') print 'reading config from', conf_path cherrypy.config.update(conf_path) config = ConfigParser.ConfigParser() config.read(conf_path) production_mode = config.getboolean('settings', 'production') current_dir = os.path.dirname(os.path.abspath(__file__)) # Set up site-wide config first so we get a log if errors occur. if production_mode: print "Starting in production mode" cherrypy.config.update({ 'environment': 'production', 'log.error_file': 'simdemo.log', 'log.screen': True }) else: print "Starting in development mode" cherrypy.config.update({ 'noenvironment': 'production', 'log.error_file': 'site.log', 'log.screen': True }) conf = webtools.get_export_map_for_directory("web") cherrypy.quickstart(Server(config), '/InfiniteNightclub', config=conf)
urllib2.install_opener(urllib2.build_opener()) conf_path = os.path.abspath('web.conf') print 'reading config from', conf_path cherrypy.config.update(conf_path) config = ConfigParser.ConfigParser() config.read(conf_path) production_mode = config.getboolean('settings', 'production') current_dir = os.path.dirname(os.path.abspath(__file__)) # Set up site-wide config first so we get a log if errors occur. if production_mode: print "Starting in production mode" cherrypy.config.update({ 'environment': 'production', 'log.error_file': 'simdemo.log', 'log.screen': True }) else: print "Starting in development mode" cherrypy.config.update({ 'noenvironment': 'production', 'log.error_file': 'site.log', 'log.screen': True }) conf = webtools.get_export_map_for_directory(current_dir) print conf cherrypy.quickstart(SetlistServer(config), '/SetlistServer', config=conf)