def load_custom_settings(config): path = find_scrapydweb_settings_py(SCRAPYDWEB_SETTINGS_PY, os.getcwd()) if path: config['SCRAPYDWEB_SETTINGS_PY_PATH'] = path print(u"{star}Overriding custom settings from {path}{star}".format( star=STAR, path=handle_slash(path))) config.from_pyfile(path) else: logger.error("%s not found: ", SCRAPYDWEB_SETTINGS_PY) try: copyfile(config['DEFAULT_SETTINGS_PY_PATH'], config['SCRAPYDWEB_SETTINGS_PY_PATH']) except: sys.exit( "\nPlease copy the 'default_settings.py' file from the path above to current working directory,\n" "and rename it to '{file}'.\n" "Then add your SCRAPYD_SERVERS in the config file and restart scrapydweb.\n" .format(file=SCRAPYDWEB_SETTINGS_PY)) else: sys.exit( "\nATTENTION:\nYou may encounter ERROR if there are any timer tasks added in v1.2.0,\n" "and you have to restart scrapydweb and manually restart the stopped tasks.\n" "\nThe config file '{file}' has been copied to current working directory.\n" "Please add your SCRAPYD_SERVERS in the config file and restart scrapydweb.\n" .format(file=SCRAPYDWEB_SETTINGS_PY))
def test_find_scrapydweb_settings_py(): find_scrapydweb_settings_py(SCRAPYDWEB_SETTINGS_PY, os.getcwd())