def main(): logging.basicConfig(level=logging.INFO) config = Config() Register(to_bytes('http://%s:%d' % (config.get('bind_address', '127.0.0.1'), config.getint('http_port', 6800))), config.get('register_path', '/scrapyd-cluster/worker'), hosts=config.get('zookeeper_hosts', '127.0.0.1:2181')) argv[1:1] = ['-n', '-y', join(dirname(scrapyd.__file__), 'txapp.py')] run()
def get_application(config=None): """Overide default get_application in Scrapy.""" if config is None: config = Config() # Override http_port by $PORT environment variable in Heroku. # Override bind_address to 0.0.0.0 if $PORT exists # Note that the http_port has to be a string intead of int. config.cp['scrapyd'].update( http_port=os.environ.get('PORT', config.get('http_port')), bind_address='0.0.0.0' if os.environ.get('PORT') else config.get('bind_address') ) apppath = config.get('application', 'scrapyd.app.application') appfunc = load_object(apppath) return appfunc(config)
def get_application(config=None): if config is None: config = Config() apppath = config.get('application', 'scrapyd.app.application') appfunc = load_object(apppath) return appfunc(config)